In wordpress I am manipulation 404 response. I want to give the response before 404 error is given to google

WordPress has a function to send a different status header: status_header( 200 ); If you send that after WordPress has send its headers and before you print anything you will get a status header 200. You could also filter ‘status_header’ and change the value there. See wp-includes/functions.php for details.

Detect 404 before headers are sent

Use a later action hook You cannot use Conditional Tags before the posts_selection hook has run (as per the codex), which happens right after pre_get_posts and quite a bit after init. Hence, would it not be easier to set the cookie at a later stage of the request, rather than attempting to detect the 404 … Read more

Changing Site Address (URL) causes 404

Go to phpMyAdmin and select the database for the website. Go to the “wp_options” table and edit the first option (option_name: siteurl) from “http://www.example.com/wordpress” to “http://www.example.com/somethingelse“. In the same “wp_options” table, look for “option_name: home” and change the URL there too. Now, rename your current .htaccess file to .htaccess_old and create a new blank .htaccess … Read more

WordPress REST API 404

I commented this, for my situation: I have this same issue. I’m on an Ubuntu-server, but I’ve simply pointed my host-file to point to the IP. I must admit I’m not 100% sure how the restful API works, if that has any effect or not. I’m on WP version 4.9.8, – and have the problem … Read more

REST API: No route was found matching the URL and request method

It’s because of how you’ve defined the accepted methods: ‘methods’ => ‘\WP_REST_Server::CREATABLE ‘, You shouldn’t have quotes around it. WP_REST_Server::CREATABLE is a string that equals ‘POST’, but by putting quotes around it you’re literally setting the method as ‘\WP_REST_Server::CREATABLE’, which is not a valid HTTP method. You can see this in the response to the … Read more

Feed 404 Errors

For all those who might hit the same problem, here is the solution: Disable in Yoast the “remove category” option in advanced section. Then install this plugin: https://wordpress.org/plugins/remove-category-url/ ( do use any other plugin as this one works – yes, I tried them all) For some reason the Yoast solution and all other plugins don’t … Read more

WordPress Theme’s 404.php not found, server defaults to Apache’s own 404 page

Things are working the way they are supposed to, and possibly the only way they can work. Let me explain. Without an Apache module called mod_rewrite (or the equivalent Nginx or IIS component) requests to PHP pages have to go to an actual filesystem file. That is what you see with requests like 192.168.1.8/wordpress/?p=123. The … Read more