Hot answers tagged

3

I do not think that there is any sane way to sort this issue with the amount of posts you have except than setting hierarchical to false. Setting hierarchical to true has huge impact on performance and aren't really meant for use in custom post types. If you do not need a parent/child relationship between posts like the build-in post type page have, then ...


2

Of course it doesn't. When you remove get_header() you also remove the code that loads the CSS files, not to mention that you remove large blocks of necessary HTML markup. The template you've posted above is very, very broken. You've also left out get_footer() which will most likely leave your markup broken as well. Instead of leaving out get_header() use ...


2

A 404 should never be a redirect. A redirection status begins with 3, not with 4. You can either include the index.php (or home.php or front-page.php) in your 404.php or just remove the 404.php from your theme. Then WordPress will use the index.php.


2

You will want to run a find-and-replace script across the database to update all URLs to reflect the new domain. Just because you change the WordPress settings doesn't mean the content stored in the database has been updated with the new domain! I've had good luck with the Velvet Blues Update URLs plugin but you can also do this type of find and replace ...


2

I cracked it! In my case I first created an author.php page (my theme lacked one) from the archive.php by cloning and cleaning it. Then I found this piece of code: <?php if ( have_posts() ) : ?> It basically says: if the authors has published some posts, then... Well, I just added: "OR NOT!" <?php if ( have_posts() || !have_posts() ) : ?> ...


1

When a URL is processed by Wordpress, its index.php script is loaded with the path to the requested page. Because in this case the index.php script is always found, a normal 404 error will never trigger (via ErrorDocument 404 …). If the requested URL does not match a page that WP knows about, WP will display its own "404" page. Unfortunately, if WP ...


1

There is currently a bug in the functionality that handles the NOBLOGREDIRECT constant, which causes 404 errors on the main site to be redirected to the value of the constant. Apparently this is the expected behaviour for sub-directory networks (example.com/subsite), but should not take place on subdomain networks (subsite.example.com). There is a WordPress ...


1

Do not use variable name "name" for html textbox control, use something else. This behavior is due to internal handling of WordPress with "name" variable found in query string of posted data.


1

After checking phpinfo(), mod_rewrite wasn't enabled so I enabled it: http://linuxcommando.blogspot.fr/2014/03/how-to-enable-modrewrite-for-apache-web.html and it worked !


1

Are you sure that you don't have a page with the same name of the custom post type? If you do, the permalink rewrite rules will get confused and trigger a 404. A very simple solution is: The page that lists the custom post types is called in plural (eg. products) and the actual post type name is in singular (eg. product). So they don't conflict and it's ...


1

When clicking on any of those links, redirecting to an URL like "root/category/post-name/", the 404 template is loaded, If you remove the category_template filter, are the links still 404? For categories, your cpt post should appear in the list of posts in that category. So the url is root/category/. When clicking on any of those cpt links, the ...


1

The problem your GET param is using the same name as the query var for your custom post type. $link = $link_aqui_se_sirve.'?'.$establecimientos_cpt_name.'='.$tax->slug; With that URL, WordPress is expecting the value of the $establecimientos_cpt_name parameter to be a post slug. Instead you are giving it a taxonomy slug. This will give you a 404 unless ...


1

Actually I got to the bottom of it. The problem was that I have installed the WPML plugin. But I forgot to install the WPML Media plugin. As soon as I installed it, the attachment pages started working again. In my opinion, this is unacceptable and I will escalate the issue to WPML team. If the Media plugin is so critical, it should be made obvious to the ...


1

Problem solved. I was advised to download a fresh copy of wordpress, delete all wp files/folders on my site EXCEPT wp-config.php file and the /wp-content/ folder, and then replace the deleted folders/files with fresh copies. This worked!


1

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 allow ...


1

The easiest way is to check for get_current_blog_id(); and adjust your 404 template based on the current blog id. An other option is creating a child theme for every site and adding different page-404 templates.


1

If you have access to the database, I suggest you create a mysql dump and then replace the old URL with the new one. After that, import the database again.


1

If you have a non-static request like: example.tld/some-slug/ then you will need to run WordPress to see if that slug is available. The webserver (nginx/apache) doesn't know that, because WordPress will have to inform us about that through the 404 response header. If your site has only few pages, then you could tell the webserver about it beforehand. ...


1

You custom post type is NOT public. Add following lines to your register_post_type array 'public' => true, 'publicly_queryable' => true,


1

Your custom post type is not publicly visible so you need to update your argument You can refer given link for that https://codex.wordpress.org/Function_Reference/register_post_type And if your custom post type publicly visible and still problem exist please Flush your permalink and try it. It will solve your problem.


1

As far as I can see, it is not possible to use a custom 404 ErrorDocument directive in your htaccess file because WordPress' index.php will always be found when processing the htaccess content. (unless ofcourse index.php got deleted for some reason) Because index.php is found, it will not trigger the '404 not found' ErrorDocument directive. The ...


1

function checkArtist() { $page = get_page_by_path($_SERVER['REQUEST_URI'].'/',OBJECT,'artist'); if($page){ header("HTTP/1.1 301 Moved Permanently"); header("Location: /artist".$_SERVER['REQUEST_URI']); } } add_action( 'wp', 'checkArtist' ); I add a custom hook using wp which as the article says: This hook is one effective ...


1

If I try to add &posts_per_page=15 to url, it doesn't work: it won't change number of post. I wonder if you're looking for a custom query variable, e.g. ppp, to change the number of posts for the main query: add_filter( 'query_vars', function( $vars ) { $vars[] = "ppp"; return $vars; } ); add_action( 'pre_get_posts', function( \WP_Query $q ) { ...



Only top voted, non community-wiki answers of a minimum length are eligible