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.

learn more… | top users | synonyms (1)

5
votes
1answer
58 views

Delete a specific category when deleting a user

I'm using the following function to create a portfolio category named "tips_username" when a user registers on my website. add_action('user_register', 'auto_create_traveltip_category'); function ...
1
vote
1answer
30 views

How to get the number of child categories a specific parent category has?

How do we count the number of child categories of a parent category? I am using a custom taxonomy, called: "authors". I found this code, which does count the number of child categories, but only ...
0
votes
0answers
32 views

How to query post from sub-categories on category archive and display posts?

On a custom taxonomy archive from the taxonomy called 'books' (taxonomy-books.php) I want to list all subcategories that are assigned to the parent category. And then for each subcategory I want to ...
2
votes
0answers
19 views

Render Selected Categories in Admin Edit Post Screen differently

Selected Categories for a post in the admin screen are rendered by: // Put checked cats on top $output .= call_user_func_array( array( $walker, 'walk' ), array( $checked_categories, 0, $args ) ); ...
0
votes
1answer
24 views

how to get postmeta info based on multiple categories?

I need to get one meta_value from wp_postmeta and I can do it with one category but I'm having problem when using another one. I have: SELECT wp_posts.ID, wp_postmeta.meta_value FROM wp_postmeta ...
1
vote
0answers
15 views

Reload parent categories list in (new) post [closed]

I have a question about parent categories list in a (new) post. I have few categories what I would like to exclude from parent categories list. When I open (new) post page, few categories are ...
0
votes
0answers
15 views

Assigning custom-single.php based on category

The code below looks like exactly what I need but I dont know how to update it to work for 3 custom single.php files plus the default single.php for any other posts not in one of these 3 categories (...
2
votes
0answers
22 views

get / list categories and counts filtered by custom taxonomy term

In my post 'post type' besides "categories" I've a custom taxonomy called "product-types". The category is actually more "manufactures" of the product types. I've a product-types page where I list ...
0
votes
0answers
22 views

Can not be able to insert the custom post taxonomy

here is my code in which i can't get insert the term in custom post type taxonomy .as in the the code in wp_insert_term($term,$taxonomy,$args); cannot work , while it is working if i put a string ...
0
votes
2answers
42 views

List all categories but exclude current post category on single post page

I want to display a list of categories excluding the category of the current single post that the user is navigating on. The list is displayed on the single.php template. I'm using this code to ...
0
votes
1answer
46 views

Change single.php template based on parent category

I have the following code working but with split() being depreciated and not available in php 7, I need some help. The idea here is this code is inserted in my single.php (in child theme). When a ...
0
votes
1answer
18 views

Why does accessing url by category cause issues with post types?

I just built a site with a few CPTs (apple, banana, cucumber). My boss wanted to split them out into categories (red, yellow, green) and link to the category pages. As soon as we did and accessed the ...
0
votes
1answer
16 views

Is there any way to check which wordpress categories was created by which user?

Showing users only those categories which was created by them only. I tried to find relations between categories and users in database but couldn't find any.
1
vote
1answer
22 views

Custom category code not showing all posts

I have a PHP template I am applying to several pages on my site so that they show a list of all posts in a category with the same name as the page. However, this is not working correctly in that posts ...
0
votes
1answer
54 views

Get Attachment Category Name

How can I call the name of an attachment category? Something that would look like <?php get_attachment_category_name ?> or $attachment->category_name This would simply output the name of ...
0
votes
0answers
32 views

Accessible Subcategory URL's pages without using .php hack

I'm attempting to setup a custom URL structure within posts that makes all parents and sub child's accessible, but all attempts have failed with various errors. My category structure looks something ...
1
vote
1answer
49 views

Could not insert term into the database

I've spent a fair while reading about the "Could not insert term into the database" error, but the fixes I have read (changing theme, fresh WP install, disable plugins) simply are not working. I ...
0
votes
0answers
22 views

Wordpress and “pretty permalink”

I've installed wordpress and set permalink structure to /%category%/%post_id%_%postname% I've also used 'No Category Base' plugin I can list all posts in category 'my-cat' on archive page //www....
1
vote
1answer
45 views

Detect whether a page is a product subcategory page?

How can I detect whether current page is a product sub category page? I've tried with the following but it will always print out "NO" function is_subcategory($category = null) { if (is_category()...
1
vote
1answer
19 views

How do I edit pre_get_post for the category the user is currently in?

I've got a Woocommerce site that uses categories and products within those categories but how do I get my search form to only display results of products within the category the user currently is in. ...
0
votes
0answers
26 views

How to get post count including nested categories

I am traversing through categories using function like this function hierarchical_term_tree($category = 0) { $r = ''; $args = array( 'parent' => $category, ); $next = ...
0
votes
1answer
50 views

How to show the posts of some category first, and then the rest? Cant figure out the coding

but to be specific, i need to retrieve certain data from the post - and showed one category's post datas first (preference) in the coupon's list and then other categories post data second in the list. ...
-1
votes
1answer
24 views

How to get Woocomerce categories count

Is there a short way to get the number of categories in woocomerce shop homepage and also number of subcategories on category page?
0
votes
0answers
21 views

Multi-tier Categories by post type?

We've been using CPT UI to allow us to create segregated categories for different post types. Unfortunately, this plugin only allows single-tier category view in the admin area. What I'm after is ...
1
vote
1answer
34 views

Remove Parent Category from Child Category URL

I am trying to remove parent category from the child category but each attempt returns a 404 error. Main Category Link (Displays All India Recruitment) Child Category Link (Displays Sub-Category) ...
0
votes
0answers
25 views

Customizing a category archive page through plugin

I have created a plugin that adds a custom post type called "Activities". This post type's archive shows all the categories, and then the categories each have a page that includes the posts contained ...
-3
votes
2answers
44 views

How do you get parent and grandparent categories [duplicate]

I'm wondering how you can receive a categories parent name and link for a breadcrumb I've written. I basically want to have the following structure if child category blog > parent_category else ...
-2
votes
1answer
44 views

How to display parent category name and link for custom breadcrumb

I'm currently trying to figure out how to display a categories parent / grand parents name and url for a custom breadcrumb I'm working on. I simply need to know how to show the parent categories ...
0
votes
0answers
11 views

Category specific attribute

I wonder what is the best way to define specific attribute for category. My idea is following. I have some categories that are just wrappers, they don't contain any post so they are only parent ...
0
votes
0answers
18 views

Is there a way I can index all my empty categories in a xml sitemap

Is there a way I can index all my empty (no posts) categories in a google xml sitemap? I've tried all the popular xml plugins but they only index categories if they have a post associated with them. ...
0
votes
1answer
17 views

Category page returns 404 error

I'm developing custom theme that should show all categories on a single page in /category path. When i navigate to /category/some-category, i can see all posts that belong to that category, but when ...
0
votes
0answers
38 views

Hide empty categories from get_categories

I'm trying to hide the empty categories (with no posts associated) from a list in an archive page. I'm using hide_empty as suggested on Wordpress codex but it's not working, the code outputs all ...
1
vote
3answers
62 views

How do I apply style to each category of a list?

I need to create a simple plugin to show a list of categories inside the body of the post and, as I am new to coding, I searched for the basics and started to make little changes; it looks like this, ...
0
votes
1answer
54 views

Custom post type and category link together

I have issue with making new page for this : Category link is : /category/category_name But I want to be : /custom_post_type/category_name Custom post type code $labels = array( ...
0
votes
0answers
35 views

Front end post submit with custom taxonomy and category

On my website i'm buildng a front end post publishing based on this article. All my posts have both category and a custom taxonomy. The problem is that I can't find a way to save both default ...
0
votes
1answer
16 views

Getting the Most Recent Posts from Multiple Categories

I've got a page (page, not post) that near the bottom of the page I want to get the most recent 15 posts from a set of categories. I'm new to doing this and thought I was doing it correctly. The div (....
0
votes
2answers
27 views

Changing the Category for all posts of an Author

I'm trying to change the category for all posts of an author. I've been looking on here for about an hour and haven't found a solution.. Any help would be greatly appreciated :) Thanks, j03
0
votes
0answers
10 views

Category and post_lists

I´m trying to make a template for a wordpress site where i need to fetch posts form two different categories - two times. (ie.two loops) But seems like the category sort is just working for the ...
3
votes
1answer
292 views

Listing a post's categories and subcategories

Is there a way to display the parent categories and subcategories for a particular post (ie. for use on single.php). I've tried using get_the_category_list(), but it displays a list like this: ...
-1
votes
1answer
39 views

Using a filter in functions.php to add content to single posts regardless if post is in main or child category

Im using following filter (codex) to add some html content with a lower priority (20) to the bottom of my single posts wich are in a specified category: add_filter( 'the_content', '...
1
vote
0answers
29 views

Get attachments for posts that belongs to a specific category

I am trying to get images which are used by a post belonging to the specific category. For example if I have plants, mushrooms and animals as post categories, I only need to retrieve images that are ...
1
vote
1answer
53 views

Sorting posts by season

What would be the best way to go about creating something like this (https://www.fiawtcc.com/calendar/) in WordPress? This is a calendar, with posts (containing the event date and event description), ...
-2
votes
1answer
93 views

query_vars category_name only display one catgory out of multiple categories

I am working on a plugin which alter the query arguments! Plugin uses $wp_query->query_vars['category_name'] to get the category slugs. Everything works when I am fetching posts from one category. ...
0
votes
0answers
47 views

Display category name only once inside loop

I have been researching on how I can output the category name on a wordpress loop for custom post only to display only once. If there are any posts under the same category, the category name will not ...
0
votes
0answers
24 views

Get posts from two taxonomies

I've created post types and taxonomies using Custom Post Type UI plugin. There are two taxonomies: rubric and city. Each taxonomy post lists are available at URLs /rubric/toaster/ and /city/kiev/. I ...
0
votes
1answer
26 views

get parent category only

Thanks to wordpress.org, the snippet below will display a list child categories link only for each respective post if there's a child category for them. <?php foreach((get_the_category()) as $...
0
votes
1answer
20 views

How to relocate images

I need to move all images attached to posts of a specific category (MyCat) from its current standard location (/uploads/year/month/) to a specific category folder (/uploads/mycat/). For instance: /...
0
votes
0answers
34 views

How to display total views of all posts of one category?

Is there any way to display total views of all posts of one category? How to show that number on archive page? I have used this code to count views of each post: function getPostViews($postID){ $...
0
votes
0answers
22 views

Limit results of custom query to current category

I have created a geolocation system for a custom post type of services and have been working on a query to limit the results based on address/distance entered by the user. Everything seems to be ...
2
votes
2answers
74 views

Filtering search results

I have pages, posts and woocommerce product categories and products in my website. I want to limit wordpress default search query so that it returns the posts, the pages, the product categories but ...