Questions tagged [categories]

Every Post in WordPress is filed under one or more Categories. Categories allow the classification of your Posts into groups and subgroups, thereby aiding viewers in the navigation and use of your site.

Filter by
Sorted by
Tagged with
0 votes
0 answers
4 views

Display ACF category image on archive and single template files

I have written this function to display an Advanced Custom Fields image custom field added to a specific category (News) in WordPress. This image displays on the category archive page and all of the ...
user avatar
0 votes
1 answer
29 views

Category archive page has two URLs even when default theme is active with no active plugins

I've changed my permalinks to Custom: /%category%/%postname%/, and that (I suppose) caused my category archive pages to have two URLs. For example, category SPORT is available on /sport and /category/...
user avatar
0 votes
0 answers
26 views

get_the_category - display only a single category for a post (not all categories)

I am trying to display only one post category for a post, instead of them all. My current code is: <?php $category = get_the_category($post_id); foreach($category as $cat){ if ( $...
user avatar
0 votes
1 answer
18 views

Image loading function not working on archive.php template

I am using the following function to display a post thumbnail or ACF custom field image depending on the page type being viewed. This function is loaded from the inc/template-tags.php file in the ...
user avatar
0 votes
0 answers
10 views

Display hierarchical categories/sub-categories for a single post only

In a single post, I am wanting to display the hierarchical posts categories, with links to the child subcategories only. For example, let's say a post is about the movie Star Wars - I would like to ...
user avatar
0 votes
0 answers
11 views

WooCommerce shared categories

I am working on a WooCommerce site where different electronics products are sold. A Product can be either a used or a new product. There are different categories e.g. Refrigerator, Freezer, Microwave ...
user avatar
0 votes
0 answers
31 views

get_the_terms has strange result since version 6.0

Since version 6.0 of WordPress some of my code with get_the_terms() doesn't work as expected in several sites where I use custom query loops. For example I have this loop where I want to get the ...
user avatar
0 votes
0 answers
17 views

How can I set a product's url to reference the primary category in Woocommerce?

Woocommerce by default does not take the primary category, but the first in the series. How can I set a product's url to reference the primary category?
user avatar
0 votes
0 answers
10 views

Setting the Primary Category for a Post Based on Context

I'm still fairly new to WordPress (maintaining an Oxygen-based site). I'm trying to solve something which would have been straightforward with our past CMS but which so far I've found no solution for ...
user avatar
0 votes
0 answers
16 views

WP-CLI Add category as menu item main-menu

I've found this documentation about adding terms using WP CLI: https://developer.wordpress.org/cli/commands/menu/item/add-term/ and tried to find out how I can add an existing category to the main-...
user avatar
0 votes
1 answer
30 views

display category with background color

i'm new in the wordpress developpment. i started coding my first theme and i want to dispay categories with color, each category has his own color. in wordpress i know that we have : category name - ...
user avatar
0 votes
0 answers
16 views

Category name for all posts getting assigned to a single random post

This site shows a strange behavior where the category names for posts fetched through get_the_category() returns an empty array. However, a single random post gets the category names of all the posts(...
user avatar
0 votes
0 answers
15 views

WooCommerce Product category can be shown with multiple related URLs

I am working on a WooCommerce eshop and I found out that a children product category can be accessed by multiple URL variation for example domain.com/product-category/parent/children can be accessed ...
user avatar
0 votes
1 answer
16 views

Assign author to category and not only posts

Is it possible to assign an author as a writer for a category? I know that authors are mainly for posts/pages, but my client has a site structure where the categories basically act as pages. I could ...
user avatar
0 votes
0 answers
11 views

displaying the last product comment in the woocommerce category

Good day! The task was set to display the last comment on woocommerce products in the parent category. Each product has its own last comment, if there are no reviews, nothing is displayed. As an ...
user avatar
0 votes
1 answer
23 views

Get slug of current category in functions.php

I want to use a certain archive template for a bunch of different parent categories. Therefor I try to change the archive template by using the 'archive_template' filter in functions.php by ...
user avatar
0 votes
1 answer
15 views

Child categories doesn't echo if it doesn't contain at least a post

I'm looping though child categories of a given parent, but what I've noticed is that it doesn't get echoed if the child category itself doesn't have any posts in relation to it. How can I echo ...
user avatar
0 votes
0 answers
11 views

Displaying Single Product Page Parent and Child Category

Is it possible to display separated terms of single product category? Example: SKU: PRODUCT SKU PARENT 1 CATEGORY : PRODUCT CHILD1 PARENT 2 CATEGORY : PRODUCT CHILD 2
user avatar
0 votes
0 answers
20 views

Remove Custom Post Category In Wordpress Slug Using .Htaccess

I am battling for days now to remove a custom post slug from Wordpress permalink. My theme Category permalink looks like this: example.com/listing-category/category I want to get rid of the custom ...
user avatar
0 votes
0 answers
95 views

Show Posts via cat+cat in URL that are in both Categories doesn’t work

it seems like i am the only person on this planet currently experiencing this issue. When i search for www.gooloo.de/category/balea+vegan, it should only show posts, that are in BOTH categories, but ...
user avatar
0 votes
2 answers
52 views

how to get full category path including parent and subcategories

How do I get the full category path including the subcategories? I am using if ( is_archive() ) { $term = get_queried_object(); $page_path = $term->slug; } https://mandoemedia.com/blog/...
user avatar
  • 1,626
0 votes
0 answers
8 views

Wordpress Primary Category Changes After Import, Permalink Issue

Ok my Permalink structure is like this - www.website.com/category/post-name Now, I have two parent categories assigned to a post cat1 and cat2. So Permalink structure become www.website.com/cat1/post-...
user avatar
0 votes
1 answer
15 views

Display Current Posts Category (with the most posts)?

I have an post article, with a title date and the category the post is assigned to. The post is in multiple categories, but i only want to show the 'main' one its in and none of the others (for now). ...
user avatar
  • 197
1 vote
0 answers
31 views

Remove parent category from child/sub-category page URL in Wordpress

I want to remove the parent category from sub-category page URL. (actually I need it only for a specific parent-category) f.e, convert the URL of all sub-categories pages under this parent-category, ...
user avatar
  • 11
0 votes
0 answers
12 views

Same category and post base

I’d like to have the following stucture: Single Post: test.com/blog/post-name/ Category: test.com/blog/my-category-name/ If I go to permaliks and set: test.com/blog/%postname%/ it works okay But if I ...
user avatar
  • 1
0 votes
0 answers
11 views

exclude certain categories form archive widget

i need some help for this...i want to hide posts of one specific category from appearing in the (sidebar-)archive-widget (chronological order, dropdown). I already tried to use the "ultimate ...
user avatar
0 votes
0 answers
15 views

Display Sibling WooCommerce Product Categories on Archive Page

To the lovely people of StackExchange, I've created the following code to list WooCommerce categories on category archive pages, and it's mostly working as I'd like. However, I'd like to modify it so ...
user avatar
0 votes
0 answers
28 views

Allow / show post comments in category pages

Is there any way to allow the users of a website to write comments (and also see the already published comments) on one post when it's displayed in a category page? I'm not looking to let the category ...
user avatar
  • 1
0 votes
0 answers
21 views

Exclude Woocommerce Product Category From Sitemap

Am trying to exclude 2 specific product categories from default WordPress sitemap. Any help how to archive this? add_filter( 'wp_sitemaps_posts_query_args', function( $args, $post_type ) { if ( ...
user avatar
  • 35
0 votes
1 answer
20 views

Wordpress bulk category select when publishing post

Often I need to attach post to all categories and I have about 200 categories. When I need to select all categories while publishing post , I select categories one by one. How can I add select all ...
user avatar
0 votes
0 answers
21 views

wp_get_post_categories not work currently on loop.php

I'd like to design the category page for them. on this page, we have to show the last category of each post beside each post title. So I want to display the last category from each post, on the ...
user avatar
  • 155
0 votes
0 answers
11 views

Post incorrectly excluded when using "category__in"?

I have a wp_query using the following arguments. While I have the 'category__in' line commented out, I get all 3 results I should. Shown below with the IDs of the categories they belong to. Category ...
user avatar
0 votes
0 answers
21 views

Add properties to term object

A typical WP_Term Object, for category might look like this; WP_Term Object ( [term_id] => 5 [name] => News and Views [slug] => news-and-views [term_group] => 0 [term_taxonomy_id]...
user avatar
0 votes
0 answers
21 views

how to remove alphabetical order of category in WordPress?

As you see in the image (momin khan momin ) is subcategory of (poetry by poet) category. But sub category is not showing exact after its parent category. categories & sub categories are arranged ...
user avatar
0 votes
1 answer
14 views

How to set category correctly for a custom post created by a remote API call?

I'm using a plugin - "cleverness-to-do-list" (https://wordpress.org/plugins/cleverness-to-do-list/#description ). I'm aware that the plugin is closed, but I've updated it at my end and ...
user avatar
  • 113
0 votes
0 answers
6 views

excude a specidic category from showing in the "relative posts"

I have a post slider on the homepage that shows a specific category (slider). The thing is that I do not want this category to appear on other pages (except homepage) because I have "relevant ...
user avatar
0 votes
0 answers
42 views

get_object_term_cache duplicate terms after update to wordpress 6

After WordPress update to 6 versions receives an issue. receive duplicated terms on function echo wp_kses_post(get_the_term_list($product->get_id(), 'product_cat', '', ', ', '')); and echo ...
user avatar
  • 1
0 votes
1 answer
27 views

Assigning a category to a custom post type in Wordpress

I am working with custom posts to create a 'document' custom post type and then trying to assign the category during wp_insert_post, have tried using both post_category and tax_input to no success. I ...
user avatar
0 votes
0 answers
21 views

How to use category slug with a regular page

To make better looking category pages in my sites, I'm looking for a way to show the content of a regular page on the permalink /category/name. How can I achieve that ? Thanks
user avatar
0 votes
0 answers
25 views

Show posts from a single category by default using wordpress.com

I have a blog at wordpress.com on the legacy "Personal" plan. I blog about different but related subjects and categorise the posts accordingly. The blog was originally about one subject but, ...
user avatar
  • 101
0 votes
0 answers
25 views

Related posts by current posts child category

I'm trying to use this code to display related posts by the same category as the current post but if the post is in a child category, i need to show related posts by that child category, not the ...
user avatar
  • 446
0 votes
1 answer
36 views

How do I add a tag slug to a category URL to filter posts?

I want to add an option to my site to filter posts by one specific tag on the category page and at the same time have a nice URL (no query strings). So something like this: https://example.com/%...
user avatar
0 votes
0 answers
11 views

Multiple categories assigned to a single product breaking the breadcrumb

custom bread crumb not working with multiple categories assigned to a single product, we do not have the categories page, so don't want to show categories in the URL, but need to show the categories ...
user avatar
  • 199
0 votes
0 answers
25 views

Display a specific category in a focused area of my site

I've been trying to change the code of my WordPress site. Rather than showing "trending posts" which is determined by post_views_count, I simply want to show posts from a certain category. ...
user avatar
  • 1
0 votes
0 answers
17 views

Post in bulk based on category template

Let's start with an example of what I want to do. take a look at hardreset.info / devicesfaq.com as you can see, the articles are almost the same, they only change few keywords / or based on title (...
user avatar
0 votes
0 answers
28 views

Pagination at category doesnt work with same name of page

i have a problem with my pagination but only at category page. I'am not developer, and i try fix it from few days. My pagination working if i make different name of pages for main BLOG, and category ...
user avatar
0 votes
1 answer
33 views

Wordpress PageNavi Plugin not working in category.php

I tried different codes to be able to use the PageNavi Plugin in category.php, but all were not working. I don't know what was the problem? here is my working category.php code: <?php $cat =...
user avatar
0 votes
1 answer
35 views

Category post count is not correct

When I go to Posts > Categories, some categories show that they have a post. See screenshot. But there are no posts linked to that category. When you click on that "1"-number, no posts ...
user avatar
  • 125
0 votes
0 answers
17 views

Display all categories but only if they have posts in them that have a specific tag assigned

I have a WooCommerce site and am working on the product tag pages. I want to display every product that is assigned to that tag, and break them up into their individual categories (this bit is working)...
user avatar
0 votes
0 answers
17 views

Sort posts by child category name

I have a category "year" and child-category names with year numbers 1966, 1972, 1980 etc. I have a category "publisher" and child-categories with publisher names. Each post is ...
user avatar

1
2 3 4 5
96