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

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

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

EDIT From your comments, front-page.php is only used when a page is set as a static front page. Normal home pages, ie, when Front page displays is set to Your latest posts, index.php is used. All archive pages and the front page uses paged and not page, so you would need to set get_query_var( 'page' ) to get_query_var( 'paged' ). Any ways, you should not ...


2

I did what Rarst told me to do. First I searched around in the Pods Framework documentation. This solved my problem. Here's what the code looks like right now. <?php $params = array( 'orderby' => 'publish_date.meta_value DESC', 'limit' => 10 ); $fltNewsPods = pods( 'fltnews', $params ); while ($fltNewsPods->fetch()) { echo ...


2

I had faced the same problem. I did the following to resolve it on an Ubuntu Server: In /etc/apache2/apache2.conf, edit AllowOverride None for /var/www/ to AllowOverride All Type in the following command to enable mod_rewrite for .htaccess sudo a2enmod rewrite Restart your apache server: sudo service apache2 restart The problem solved!!!


1

I have experience with this issue and find solution maybe work with your problem Check Wp-Content Permission change to 775 Delete or rename your .htaccess like .bkphtaccess Setting permalinks as default and save Turn back permalinks as your custom permalink and save If allowed new .htaccess will create automatic, if not copy text at the bottom permalink ...


1

WordPress doesn't support such versioning natively. While there is revisions functionality it is exclusively for keeping history of the changes. There is always only one instance of actual original post at any time and it can only be in one status at the time. So either it is published, or draft, or pending. There is no such thing as "published with update ...


1

I believe there is no such "All Categories" archive page natively (because it would be just like the blog page - since every post have a category) . I recommend you to create a page template copying that code and modifying the query to include all posts and then creating a page with the slug 'category'. <?php /* * Template Name: Category */ ?> <?...


1

The $post global is not set on 404 pages, which leads to the error you are getting. You can either check if $post is set or bail if the current page is a 404 page or do all of the above EXAMPLE /** * enqueue scripts used in frontend * */ function sama_enqueue_scripts() { global $post, $sama_author_review; if ( !isset( $post ) ) ...


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 ) { ...


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

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

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

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

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

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


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

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

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

I had the same issue and found a solution. From what I learned so far, there might be two causes to this problem: WP doesn't recognize your rewrite rules because they are not cached yet. You can check this by dumping get_option( 'rewrite_rules' ); and if your rules did get cached, then they'll be in that option. To ensure your rewrite rules are cached, ...


1

After nearly plucking my hair editing the htaccess I finally found a solution that will work for WordPress. I had this problem after installing a codeiginter script on the same root directory that WordPress is installed. After trying all the tricks listed here I was still getting 404 errors on the pages associated with the new script. I noted that the ...



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