Exclude JS file from 404 error page

There is is_404(). I normally use it to do just the opposite, to add CSS and JS animations which are specific to the 404 error page. In your case that would be: function wpse_339946() { if ( ! is_404() ) { wp_enqueue_script( ‘tracking-js’, get_template_directory_uri() . ‘/js/tracking.js’ ); } } add_action( ‘wp_enqueue_scripts’, ‘wpse_339946’ );

404 error- issues with pages after adding custom rules for posts

Why it happens The error 404 on the th/<page slug> pages occurs because your custom rewrite rules overwrite the default Page rules which would otherwise load the correct Page (having the slug <page slug>). How to fix the issue If your permalink structure is /%postname%, i.e. example.com/<post slug>, then a simple fix to the error … Read more

Issue with htaccess redirection in WP Multisite

Every URL that has example.com/<non-existent-page> redirects to the main page: example.com/es/. This is presumably being done by WordPress itself, as there is nothing in what you’ve posted (in .htaccess) that is doing this. You probably need to add an additional “wildcard” redirect to redirect /<anything> (except for /es and /en) to /es/<anything>. For example: RewriteCond … Read more

AWS WordPress Install – pages/posts 404 on restart until updating permalinks

This answer was based off the comment from @Rup on the question. I needed to add a .htaccess file to my source. I did this with the default contents: # BEGIN WordPress RewriteEngine On RewriteRule .* – [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] RewriteBase / RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] # … Read more