WP page 404 error only on mobile
I solved this. I had the page in draft mode. Hence, it was only showing when I was logged in.
I solved this. I had the page in draft mode. Hence, it was only showing when I was logged in.
A search shows the search template regardless of whether or not there are any results, which is either search.php or index.php if that template doesn’t exist. If you want to load an entirely different template, you can use the search_template filter. Assuming your theme’s 404 template is 404.php: function wpd_search_template( $template ) { if( ! … Read more
Following @CraigWayne’s suggestion to use Query Monitor… Message: “Use of undefined constant term_name – assumed ‘term_name’”. Count: 1. Location: wp-content/themes/elegant/taxonomy-source.php:38. Caller: wp-includes/template-loader.php wp-includes/template-loader.php:74. Component: Core. >>>>> Line 38 in taxonomy-source.php included “” it was objecting to term_name in my taxonomy-source theme file; I changed it to $term = get_queried_object(); followed by name; ?> The takeaway … Read more
I know – I hate the fact that Google indexes the site code, and then floods my logs with 404s for old files. You can add something like this to your robots.txt file: User-agent: * Disallow: /wp-content/plugins/ Disallow: /wp-content/themes/ You could probably just have Disallow: /wp-content/ but that would also stop your images in the … Read more
No, it’s not. Single quotes can’t cause redirects.
Seems like a good candidate for add_rewrite_endpoint(). add_rewrite_endpoint( ‘items’, EP_ROOT, ‘item_id’ ); That will register the endpoint /items/<item ID> and also registers the query var item_id, and eliminates the 404 status header/title as well. But the page title would be the site name and you’d probably still want to hook to pre_get_document_title to customize the … Read more
My first step would be to turn on WP_DEBUG in your wp-config.php file. Edit wp-config.php and add the following lines: define( ‘WP_DEBUG’, true ); Then visit your site’s admin (example.com/wp-admin) and see if an error appears. More than likely the plugin you just added broke the site, so you can go into your local filesystem … Read more
I found the solution and will post here on the off-chance it helps someone in the future. The bottom line is there was a typo in a function that responded to POST requests. I narrowed it down to one file by disabling portions of my plugin in the activation class. By doing this I determined … Read more
So yes, the key point here is that you should put the WordPress-specific 404 template file in the theme directory (e.g. wp-content/themes/your-theme/404.php) and not in the root WordPress directory. And despite that you already got the solution, I thought you would still want an answer to the following? I would like to figure out what … Read more
In your screenshot I see you’ve put that image in a folder called “Images”. When you check the console, it tries to fetch the image in location “/wp-content/uploads/2021/06/bg-10-free-img.jpg”. Isn’t it simply the case that your URL isn’t correct?