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
0answers
13 views

I have made a custom type post for a new plugin I am working on. How do i set default categories for the custom posts?

So i am developing a new plugin for a Health site. And i have created a separated custom type post "Health Posts". But now i want to make two default categories "Underweight" and &...
1
vote
0answers
15 views

How to filter my posts by categories and tags simultaneously?

I need your help with advice for post-filtering in WordPress. I will describe the situation briefly: I created the main categories of posts which I placed in the main menu: Accessories; Exterior; ...
0
votes
0answers
15 views

Show child's category image in main category page

problem here In every category I display its child subcategory as a navigation, but I'd like to display the thumbnail next to it also. Currently I use that code <div class="col-md-6"> &...
0
votes
0answers
7 views

List archived posts by subcategory

I would like to override the default post archives, via category. In some cases (not all), I have 2 level-categories, such as: Parent Category: "Video" Subcategory "Comedy" ...
0
votes
0answers
9 views

Categories links suggestions same with link-to-post suggestion autocomplete from within the editor

I'm struggling to add links from within the content (WP Gutenberg Editor) to categories, in the same way WordPress deals with posts. Using autocomplete, when searching for an internal link, you can ...
1
vote
1answer
26 views

Hide woocommerce category name from specific pages

I need to hide the name in the category box from a specific page. I need to show the name in all other pages but this one. Is there a way to use this CSS for a specific category? Thank you! .box-text-...
0
votes
0answers
12 views

Import ID Categories from CSV file

I'm trying to import a CSV file with custom header columns. My 4 header columns are: id categoria ; id Padre ; Nombre ; Padre It is in spanish but it translates as: id Category, parent id, Name, ...
0
votes
0answers
14 views

Unset category in query

I'm doing the following to limit my rss feed to certain post categories: function exclude_category($query) { if ( $query->is_feed ) { $query->set('cat', array(6, 48)); } return $query;...
0
votes
1answer
20 views

Get category slug of the Parent category of a Product

I want to add a back button to the Single Product page so that the page will be redirected to the relevant parent category page of the product upon clicking. I have managed to get this done for one ...
0
votes
0answers
14 views

Custom url structure for specific categories Wordpress

I'm using the following code in functions.php to add /blog/ to the url of blogposts in specific categories. Now I would like to know how I can adjust this code to have it apply for all child ...
0
votes
0answers
6 views

Is there a way to ask for help or information on a pre-existing discussion without breaking any rules?

I think this exchange may hold an answer to my problem, but I haven't been able to query the participants. Can someone tell me how to implement this and/or where to paste the code? wp_nav_menu not ...
0
votes
0answers
19 views

Add filter for specific category only

I've been working on trying to hide all other categories from the category widget when a particular category is selected. So, as an example, the site has 5x Products categories and and 1x Services ...
0
votes
0answers
13 views

Show Pages for all Category Links but not for Childless Categories

i can rewrite Category base in Permalink Settings or use function wpa_alter_cat_links( $termlink, $term, $taxonomy ){ if( 'category' == $taxonomy && 0 == $term->parent ){ return ...
1
vote
1answer
39 views

Get term by slug in Gutenberg

In Gutenberg, one can use the getEntityRecord selector to get the data of a term of a specific taxonomy by its term id: // Get the category term with term id = 25 const term = useSelect( ( select ) =&...
0
votes
0answers
26 views

On clicking on the category name the page is redirecting on 404 pge

I have created a custom post type and added 60 posts and added each post in the category. I am able to display the post and category on the page and I am using the below code function intelligenceList(...
0
votes
0answers
10 views

Link Parent Category to Pages and last child category to category.php

I am trying to implement Silo Structure to my Page. I got usually 3 categories added to a post and I have set the permalinks to /%category%/%postname%/ I removed the /category/ base with "."...
0
votes
0answers
15 views

WordPress 5.4 and higher: Filter posts by category 1 AND category 2 in API requests

We have a WordPress 5.4 instance that we query through it's API. I am hoping to find a solution for the following problem that works with newer versions as well. What I need is an intersection when ...
-4
votes
0answers
16 views

How can I change how the category and subcategory are displayed on a post? [duplicate]

I'm trying to change how the categories and subcategories are displayed in a post. As you can see in the following image, the Category (España) is displayed before the subcategory (Valencia), but I'd ...
0
votes
1answer
34 views

How to change the order of the subcategory and category in a post?

I guess it is something simple which I'm not able to see. Any help would be much appreciated. Best, M.
0
votes
1answer
27 views

Add image to each podcast series (or category) in headless WordPress instance [closed]

We have a WordPress instance that we query through it's API. Contents are posts, or episodes from a Podlove plug-in. We have four podcasts, though at the moment only one is set up in Podlove. We ...
1
vote
1answer
16 views

need to add custom field in more products

Hi i'm gonna be completely honest idk shiz for code i just need this to work on my site, there's a category of products that i want to have this custom field how can i code it to do that?, this is the ...
0
votes
1answer
11 views

Properly setting up a feed

I have tried to setup a feed following the instructions here: https://wordpress.org/support/article/wordpress-feeds/ According to the instructions, https://sport-1a.de/category/Blog-Artikel/feed ...
3
votes
1answer
24 views

Automatically add product_categories to nav_menu

I've been googling around about days working for a client and would like that every time they add a product_category, it should get automatically added as a sub-menu item in the Primary navigation ...
0
votes
0answers
9 views

Transfer post categories along with the posts to woocommerce categories & products

I'm seeking of a way to convert post categories and posts associated to them, to WooCommerce products and categories. What is the best way to do it? Thanks in advance!
0
votes
0answers
20 views

Allow Custom Role to edit a custom post type category

I have created a custom role, and have given access to edit a custom post (from another plugin). This works, but the user with the custom role can edit the post, but not set the categories. They ...
0
votes
0answers
21 views

How do I get the category terms (multiple) queried on a category page?

Here's an example of a URL showing results from both the foo or bar category (note: I'm using pretty permalinks): https://example.com/category/foo,bar Based on this URL, and without parsing the URL ...
0
votes
1answer
19 views

How to create category filter on a blog like on the site below?

I want to create a blog with different categories of content and I would like the have a category filter on it. But I don't want to create different pages for it. I want the posts to just adjust ...
0
votes
1answer
27 views

Change category display name function

Is there a smarter way to write this function? Maybe with wildcards? add_filter( 'get_the_archive_title', function ( $title ) { if ( is_category( 'alphabetical' ) ) { $title = 'All ...
0
votes
0answers
10 views

Wordpress permalink, show a product catagory page on a normal WP page

I'm not sure if I'm having a bad brain day but I am going round in circles with something I know is so simple. As a note, I am pretty new to developing in WordPress so apologies if it genuinely is ...
0
votes
1answer
45 views

Remove /category/ from category (archive) page URLs (without using a plugin)

A Category page URL structure looks like this: example.com/category/cat/child_cat/ How can we do: example.com/cat/child_cat/ Without the use of a plugin (eg, Yoast)?
0
votes
1answer
20 views

Php string not working in Wordpress Functions.php [duplicate]

How to pass the following code. <div> <?php $category = get_the_category(); ?> <a href="<?php echo get_category_link($category[0]->cat_ID); ?> "> <?...
0
votes
0answers
60 views

How to get tags when using publish_post

I need to get tags from new posts as they get created. Problem is, with my current code, the tags can't be grabbed when using publish_post as the hook upon post creation, as publish_post fires BEFORE ...
0
votes
1answer
43 views

How to put an array in is_category

I try to put an array in a is_category(): I have my array like this $term_id = 7; $taxonomy_name = 'category'; $termchildren = get_term_children( $term_id, $taxonomy_name); $mycategory= array(); ...
1
vote
1answer
23 views

How to get all post categories without custom post type categories?

I am creating a Blog in wordpress. I have a list of categories: Technology, Art, fashion, Home, Lifetime, Education, Business, Religion, Design and home, Marketing In which some of these categories I ...
0
votes
0answers
10 views

How to show in archive page(current category) subcategory label with there post list

Category list Category one with link Category two with link Category three with link When click each category go to the category archive page I want to show here something like this Current Category (...
0
votes
0answers
29 views

I want to display category post on WordPress single page

I have created 3 special categories. Under these three categories there are subcategories at 4/5. Now I want the visitor to open a single post from these categories, then the parent category of that ...
0
votes
1answer
29 views

How to select category on if function

I am trying to create an automatic post from WordPress to Telegram Channel. It works for everything but I can't select just only one category. This is the code i am trying to use: function ...
0
votes
1answer
24 views

Odd results in get_the_terms vs wp_get_post_terms

I'm trying to make a breadcrumb function and I nearly have it don but one small snag... When I use: $categories = get_the_terms( $post->ID, 'product_cat' ); I get back an array of categories to ...
1
vote
1answer
62 views

PHP variable not regenerating when publishing multiple posts at the same time

Context: I am building an automated system which will grab record from a database and immediately publish them en masse as a CPT. When they are being published, I have a function in the functions.php ...
0
votes
1answer
23 views

How to check parent & child category

I just want to display a section in the parent category. And I want to display another section in the child category. How to do it? if ( is_category() ) { get_template_part( 'template-...
1
vote
0answers
22 views

Taxonomy name repeating when showing 2 posts from each category

I am trying to get my page to show a custom taxonomy and then a the first 2 posts in that taxonomy, My taxonomy is called types post type is called guides I want the page so it shows like this Type 1 ...
0
votes
1answer
14 views

Access category within rss2_head hook?

Can I access the current category of a category feed with the rss2_head hook to add for example itunes tags? Lets say I have wordpress.com/catx/feed I want to get acf field elements associated with ...
1
vote
0answers
12 views

Category being displayed without base parmalink

My permalinks are set as /%category%/%postname%/ But I am getting duplicate pages domain.com/category/jazz is also the same as domain.com/jazz I do not want domain.com/jazz to display as an archive ...
0
votes
1answer
22 views

Setting a default text for excerpts of a particular category

I am extremely new to WordPress Development and PHP in general, and was wondering if there is a way to create a function that would automatically add some pre-determined text to the excerpt of posts ...
0
votes
1answer
21 views

Wordpress Show Parent Category Description for Sub-categories

I'm using the Category description, for the parent category, to display above the posts on the category.php page. But, this desc doesn't show on any sub-categories of this parent category, and there ...
0
votes
0answers
26 views

query hook parse_tax_query function takes no effect

I'm trying to build a function (inside a plugin), which limits the shown posts to the time a logged in user is registered in weeks. (So if a user is registered for 4 weeks the categories page shoud ...
0
votes
0answers
8 views

Query posts according to previously selected categories of logged in user

How do I query posts according to categories that a user selected at registration? The posts would be from a custom post type and match with existing post categories + custom field categories from ACF ...
1
vote
0answers
6 views

Display Featured Post by Categories and Avoid duplicated posts

I'm learning Wordpress development on Udemy and currently developing a theme. I haven't added any custom taxonomy but just using the "Post" and "Categories". Found a tutorial of ...
0
votes
0answers
17 views

How can I order all subcategories alphabetical independent of the parent categories?

These are my hierarchical three level categories: - Top-Level Cat 1 - Sub1A - Subchild1A1 - Subchild1A2 - Sub1B - Subchild1B1 - Subchild1B2 - Top-Level Cat 2 - Sub2A - ...
0
votes
0answers
51 views

How to get specific (grand parent) category of current post?

I am having a category hierarchy with three levels. My example: - Top-Level Cat 1 - Sub1A - Subchild1A1 - Subchild1A2 - Sub1B - Subchild1B1 - Subchild1B2 - Top-Level Cat 2 - ...

1
2 3 4 5
93