You need to provide a higher priority number than the default when removing hooks.
If you leave it default there’s a chance that your remove_action
is executed prior to the add_action( 'template_redirect', 'wp_old_slug_redirect' )
So, instead:
remove_action( 'template_redirect', 'wp_old_slug_redirect', 20 );
You also need to prevent WP from saving the old slugs which can be turned off by removing these filter hooks.
remove_action( 'post_updated', 'wp_check_for_changed_slugs', 20 );
remove_action( 'attachment_updated', 'wp_check_for_changed_slugs', 20);
Related Posts:
- Homepage redirects to other site of mine? [closed]
- stop redirection on /wp-admin call to /wp-login
- How to get site URL if database is disconnected?
- Adding rewrite rule dynamically for search results redirecting to 404 URL
- Redirecting to old domain after migration website
- How to pass a message using template_redirect
- Why does the $_GET parameter ?search forward the front-page to the archive/blog page
- A change in URL slug in database returns 404, how can I do auto-redirect?
- Trying to re-direct users to specific page based on an ACF variable
- Displaying requested data from a the database in wordpress
- Internal redirect from page to category
- After Migration From dev, Only my Links to the Homepage Still Redirect to dev
- Send data to database after redirect (and popping out of iframe)
- Redirect Issue: WordPress database
- Redirect to a subdirectory frontpage using without using a WP plugin- what files to edit, and how?
- How to resolve ORA-011033: ORACLE initialization or shutdown in progress
- Oracle SQL query for Date format
- Failed to connect to mysql at 127.0.0.1:3306 with user root access denied for user ‘root’@’localhost'(using password:YES)
- Can I have multiple primary keys in a single table?
- wp_redirect() function is not working
- Database connection close
- WordPress HTTPS redirect loop
- How to create bulk page and content? [closed]
- Importing posts from old website to new conflicting post ID’s?
- Transient RSS feeds in wp_options not removed automatically?
- Best way to move live site local
- The revisions table in my database is at 70% capacity and growing. What should I do?
- WordPress for a very large website
- Database location in WordPress
- WooCommerce with thousands of products – site is very slow – optimize db queries? [closed]
- WP_list_table bulk_action get edit and delete
- How to display data from custom table in wordpress database?
- Change SQL get_results to search for posts with custom term in custom taxonomy
- Temporary redirect prevents getting $_POST array
- Add search Value to wp_list_table pagination
- stdObject stored in database. How does one convert it to usable format?
- I have a table I created, how do I make a form for a user to filter the data?
- What ALL can cause “Another update is currently in progress.”? [closed]
- Trigger Plugin database update after git pull
- Does WordPress ever need multiple databases?
- Why are no posts showing despite my apparently correct DB restoration?
- How to auto login after registration? [duplicate]
- Cannot update custom database table row
- Change WordPress prefix for only one table?
- Two websites one database, administrator not working on second website
- Multiple wp_options tables to share content across installs
- Select two sums with single get_var statement
- How to get the SQL of the changes made to the database from an update or upgrade?
- Is there a smart way to obtain a list of only some selected user meta data?
- Why does importing copies of the database dump and the document root make WordPress data inconsistent?
- Make an Items attribute searchable (taxonomy using existing attribute)
- Force HTTPS 301 redirect with hook
- Store partial database to an archive database time to time
- Migration: Copying database content to a different server
- Check if post id exist in table than only update instead of inserting new row
- Detail explanation of wordpress database fields and metatag list [closed]
- How to convert srcset links from https to http?
- How to get a list of WordPress default database tables?
- How to transfer from localHost to live but use the already existing database on the server?
- Backing up WordPress database and files
- Missing domain http://./wp-… in redirects
- Creating and Using Tables in the WordPress Database
- Why does the first page of one category redirect to empty page 4?
- Connect a membership plugin to an external database
- Storing user’s data on external database on other server
- is it right choose to connect database in template page directly in WordPress site?
- How to insert a value to decimal type field using wpdb->prepare?
- I wanted to Know that how can I give ingore to 0000-00-00 in my config file
- Set a cron job to delete a specific database table table every midnight
- Two separate wordpress installations at one domain
- Is there a way to edit the WP content database in an admin panel or external page?
- wordpress automatic URL ‘page’ parameter rewrite
- SQL database import #1046 error
- Get all top categories, then only 3 posts for each
- Having all “non-PHP” files on a different server
- Finding a page holding a specific string/URL that is used in the content
- “wordpress error in establishing database connection” and missing tables
- next comment id number wordpress
- Adding last value from Database as text in WordPress Page
- Migrate not successful, DB is broken. How to fix, or at least output static HTML without plugins?
- Backup Restore turns carriage returns to literal strings
- I have a WordPress 4.6 database dump – how do I use it in a new install?
- Find/ascertain latest wordpress db from multiple database copies
- Clone a Post Tite and Custom Field into Custom Post type
- Local Content different from Remote Content
- Check if a database is well installed
- WordPress + Postgresql
- Author ID mismatch from database
- MySQL Database User: Which Privileges are needed?
- Import Excel (or csv) Table with user-data as subscribers to wordpress
- Automatic add record after refreshing page
- Trying to edit a WP site locally using MAMP
- SQL query : Select a thumbnail for a media
- WordPress API standard compliance and specification for external database [closed]
- Log IP of users who click a button? [closed]
- Problem with form database connectivity
- Server database problem
- Cannot find redirect – WordPress behind HTTPS proxy (Cloudfront)
- #1067 – Invalid default value for ‘post_date’ when trying to create a new column
- How to CRUD remotely hosted WP database without root?