Changing category base slug results in 404 errors on posts?
Changing category base slug results in 404 errors on posts?
Changing category base slug results in 404 errors on posts?
WordPress Custom Post Type Archive, filter by category and get pagination working
When I refresh the error page, it just refreshes. If the rule has been put in the correct place in the .htaccess file (ie. near the top of the file before the existing WordPress code block) then you shouldn’t be seeing an “error page” at all (if the redirect occurred correctly). (If you place this … Read more
WordPress menu disappears in category pages
When using get_terms with hide_empty = true, terms that only contain scheduled posts are not returned. How to override this?
A news category can work great, but if you want to keep the news section separate from your main blog (homepage) it will require custom code to exclude it and it also leaves you with little room for customization. I would personally recommend creating a custom post type. I made a free plugin that makes … Read more
you can do that on php side with this hook : // the 2nd “post” of the hook is the post type add_action(“save_post_post”, function ($post_id, $post, $update) { if ($update) { // a post is updated return; } if (!isset($_GET[“preset_category”])) { return; } $term = get_term($_GET[“preset_category”]); if (isset($term)) { wp_add_object_terms( $post_id , $term->term_id , $term->taxonomy … Read more
You need to first store your sub category id and pass that to WP_Query. Below is the logic how we can store the child category value. $categories = get_the_category(); // store the subcategory id $sub_category_id = []; foreach($categories as $category) { if( $category->parent > 0 ) { $sub_category_id[] = $category->term_id; } } $args = array( … Read more
That title is coming from archive.php file of TwentySixteen theme. You can find a <header> code section in that file. What you can do, simply copy the archive.php file as category.php and then remove the following code section from category.php file: <header class=”page-header”> <?php the_archive_title( ‘<h1 class=”page-title”>’, ‘</h1>’ ); the_archive_description( ‘<div class=”taxonomy-description”>’, ‘</div>’ ); ?> … Read more
OK, found it. it is possible to have the same slug for a page and a category name. The problem was that someone installed a “redirection” plugin that caused the problems. Lesson learned is to restrict the capabilities of people working on the website, so that they cannot install plugins..