Firing a function AFTER redirect

I am using a function that redirects the user to a custom page, rather than wp-login in the event of errors. In my case I am using the Http Referer function to send the user back to the same page because I have the login form in a modal. How can I execute a function on the redirected page, so that the page automatically opens the modal? This is the code for the redirect in the event of an error: …
Category: Web

Redirect htaccess does not work correctly with my new wordpress site

I have an old website that works fine (www.example.com). I have created a new website (www.example.com/wordpress) and I thought I could use .htaccess to redirect as I've done it for other html websites in the past. I get the result: www.example.com/worpress/wordpress/wordpress......... until it's in error. Can someone help me? I used this command in .htaccess: Redirect permanent / http://www.example.com/wordpress/
Category: Web

Jet filter redirection to single post template

I am using the jet filter plugin to filter posts, After applying a filter, I want the "apply filter button" to redirect me to single post template of filtered post ( not on archive page for where the posts listing is shown ) Any one can help me with code?
Category: Web

Wordpress multisite subdirectory redirect infinite loop issue

Any time I create a new site on my multisite install, I get an infinite loop redirect when navigating to that site's admin. I'm using the default htaccess supplied by WP for my subdirectory install. Here's what I have: RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] # add a trailing slash to /wp-admin RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L] RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) site/$2 [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ site/$2 [L] RewriteRule . index.php …
Category: Web

How to define a rule in functions.php that ONLY disables the default wp functionality that undesirably changes '&' to '#038;'?

I use a quick redirects plugin and it's changing my URLs after the fact and thereby breaking some of my links. I never want wordpress to change & to #038;. There is an unwanted solution to turn off all wp_texturize by placing: remove_filter('the_content', 'wptexturize'); I don't want to disable everything, just the & conversion in URLs. I can physically modify wp-includes/formatting.php by commenting out this line, but it didn't work: $content = preg_replace('/&([^#])(?![a-z1-4]{1,8};)/i', '&$1', $content); I don't want to do …
Category: Web

Blog post is redirecting to home page

It wasn't doing this before, and I'm not sure what has caused this to change. I have tried: clearing cache changing permalink structure, saving, and setting back again unpublishing and republishing So far nothing has worked. The blog post shows up on the /blog page, however when I click on the 'read more' link, it redirects to the home page. If I try navigating directly, it will also navigate to the home page.
Category: Web

Bookmark anchor link to load another page first before completing?

Question: is there a way for a link to an anchor bookmark to arrive at its destination by loading another page first? I'm developing a vertical-scrolling style website where the home page displays the contents of 3 other pages within sections or divs. Each section has a bookmark and a "back to top" link, and my main navigation menu uses custom bookmark anchor links. I'm also using thejQuery smooth scrolling plugin which works very well. The problem I'd like to …
Category: Web

redirect does not work in ajax function

I'm using ajax to post the form data. In the end I want to redirect to homepage. I'm trying following code, it does not work. It returns error 302. How can I redirect in the following function? Thanks. add_action('wp_ajax_nopriv_custom_register', 'custom_register'); add_action('wp_ajax_custom_register', 'custom_register'); function custom_register(){ //process wp_redirect( home_url() ); exit; }
Category: Web

Redirect all posts permalinks from ".html" to "/"

How can I redirect all posts permalinks from .html to / in WordPress? To be more clear, for example, a post URL like this: http://example.com/%category%/%postname%.html To be redirected to: http://example.com/news/%postname%/.html It's simple to redirect them one by one, but I need a rule to redirect all posts. My current .htaccess setup is: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress
Category: Web

Why wordpress multisite redirect to wp-signup if site exists?

I just create a site on my Multisite domain (example.com), for instance site1.example.com After this, I try to enter on https://site1.example.com/wp-admin, but I'm redirected to https://www.example.com/wp-signup.php?new=example.com My .htaccess containt this lines: RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] # add a trailing slash to /wp-admin RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L] RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L] RewriteRule . index.php [L] I have installed, among others, this plugins …
Category: Web

Can't login to Wordpress admin panel after changing domain to use Wordpress pages as a fallback from React

we had our Wordpress page running on example.com. But now, we're developing new React website, which already has some of the webpages ready. We use Vercel to host that React website. We want React/Vercel to host specific pages (which are already developed) and serve the wordpress page as a fallback. E.g.: React already has page example.com/pageA ready, so we want that URL to be served directly by Vercel/React. On the other hand, React doesn't has page example.com/pageB ready, so we …
Category: Web

Pagination redirect set in .htaccess file is not working

I'm trying to redirect like below but it's not working. http://example.com/page/2 -> http://example.com/item/page/2 Below is the source of .htaccess file: RewriteEngine On RewriteCond %{HTTP_HOST} ^www\.hogehoge\.com RewriteRule (.*) http://hogehoge.com/$1 [R=301,L] RewriteRule ^hogehoge.com/page/(.*)$ http://hogehoge.com/item/page/$1 [R=301,L] # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress
Category: Web

Site redirects to wrong url when saving settings

I have a subdomain: https://blog.example.com/ I forcibly redirects to subdirectory: https://www.example.com/blog By changing site URL and some RewriteRule on .htaccess. Now the website and admin works fine except a small issue like when I tried to click save button on settings page (eg: Setting > Writing ) the site redirects to main domain: https://www.example.com/wp-admin/options-writing.php?settings-updated=true /blog is missing in the URL and end up in to main website 404 page. My .htaccess file looks like : # BEGIN WordPress <IfModule mod_rewrite.c> …
Category: Web

Old blog/ and blog/feed/ URLs not working after moving blog to top-level via .htaccess

For a long time I served my blog from http://www.murrayc.com/blog/, with the wordpress installation in /home/murrayc/murrayc.com/blog/. Now I've moved it to http://www.murrayc.com/, without moving the wordpress installation on the filesystem. I did that by: Changing the "Site Address (URL)", in Settings->General, to http://www.murrayc.com. I kept the "WordPress Address (URL)" as http://www.murrayc.com/blog Adding a RedirectRule in my top-level .htaccess at /home/murrayc/murrayc.com/, so that, for instance, permalink/something could be used instead of blog/permalink/something. The older blog/permalinks still seem to work too. However, …
Category: Web

Multisite Redirection to new domains

I have a multisite website with 5 domains in WordPress which uses WordPress MU Domain Mapping plugin. I want to redirect every subpage to new domain, but we will be still using the homepage, because it contains some links inside of it, so root, wp-admin and wp-login, should be still accessible and not redirected. How to set this up in .htaccess so WordPress will still function? example of a domain: oldone.com/ --> no redirection oldone.com/wp-admin --> no redirection oldone.com/wp-login --> …
Category: Web

redirect after submiting post for review

I have a frontend page that allows "Tutor Instructor" role, to create a course and this course is a custom type post called courses, when the Tutor Instructor finishes creating the course he must click submit for review. when he clicks that button, the page will refresh and change the link to the editing link of the course (https://**************.com/dashboard/create-course/?course_ID=13865). I want when the Tutor Instructor clicks submit for review the page redirects him to another page for example (https://**************.com/thank-you). How …
Category: Web

Trying to re-direct users to specific page based on an ACF variable

I have a case where I have an ACF variable that is stored within a users profile and based on that variables state I need to redirect to one of two pages once the user logs in. This is just a true or false value that will represent if a user has logged in before. I have tried using wp_redirect to do this and it does sort of work but seems to run excruciatingly slow and sometimes will briefly get …
Category: Web

Can't add new plugin or themes on a wordpress multisite network from the primary site as administrator. Error: ERR_TOO_MANY_REDIRECTS

I can't add new plugins or themes on a wordpress multisite network from the primary site as super administrator. It shows this error: ERR_TOO_MANY_REDIRECTS. However, I am able to access all pages, login to each site's dashboard or even make changes to existing codes for installed plugins or themes. I am not able to install any new ones and the network is stuck in a loop. However, the problem can be avoided if I turn off the multisite option using …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.