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
54 votes
3 answers
49k views

Is There a Difference Between Taxonomies and Categories?

I've been reading the codex for WordPress closely and am confused about the vague definitions between what a Taxonomy is and what a Category is. For that matter, term is also a word that is used in ...
gate_engineer's user avatar
42 votes
4 answers
181k views

Get Posts Under Custom Taxonomy

I am not getting the posts under custom taxonomy(fabric_building_types). I am getting cat_id and cat->name also but not able to get the posts. $args = array( 'type' => '...
Parth Kumar's user avatar
37 votes
7 answers
42k views

Adding Fields to the Category, Tag and Custom Taxonomy Edit Screen in the WordPress Admin?

The question is "How do I add one or more fields to the Category, Tag and Custom Taxonomy Edit Screen in the WordPress Admin?" This question was asked on the wp-hackers list August 1st 2010 and I ...
MikeSchinkel's user avatar
  • 37.5k
32 votes
1 answer
84k views

How To Find Out Wordpress Category Table in MYSQL?

I know WordPress stores all post data in 'wp_posts' table. But here WordPress not define any category id or reference related with it. Please let me know, how 'wp_posts' table find out exact category?...
user1218948's user avatar
30 votes
2 answers
128k views

List all subcategories from category

How can I get all subcategories from a certain category?
Fuxi's user avatar
  • 769
29 votes
3 answers
34k views

Only one category per post

How to make each post/page have one and only one category. Categories could have radio box instead of checkbox next to each.
Adam's user avatar
  • 361
28 votes
4 answers
98k views

Add custom field to Category

I'd like to add custom fields to a certain category. A category only has the following fields: Name: Slug: Parent: Description: Since I have a TV Series Site, I want to add some more fields, I ...
user avatar
26 votes
9 answers
88k views

Get Category ID inside Category template

how do I get the cat ID inside the Template. Very important: I can not do it by the name, because we have muliple cats with the same name. Only the slug is different. If I'd get the slug, it would be ...
Laura's user avatar
  • 261
23 votes
4 answers
135k views

Get the children of the parent category

I'm trying to get all the children categories to display in this loop but I'm struggling with the code. This is what I have so far. <?php $args=array('orderby' => 'name', 'order' => 'ASC'); ...
Chris Da Sie's user avatar
23 votes
8 answers
46k views

WP REST API: filter by category 1 AND category 2

I have been meddling with REST API and I am stuck with this: How can I filter posts in both cat1 and cat2? For now, ?categories[]=45&categories[]=50 returns in category ID 45 OR 50 - how can I ...
Jesse P Francis's user avatar
23 votes
4 answers
31k views

Adding categories to custom post type in permalink

I know people have asked this before and have gone as far as adding the custom post type, and rewrite for permalink. The problem is I have 340 existing categories which I would like to continue ...
hash's user avatar
  • 231
22 votes
6 answers
41k views

add_action hook for completely new post?

publish_post Runs when a post is published, or if it is edited and its status is "published". Action function arguments: post ID. -Plugin API Documentation I've added the publish_post hook to ...
leeand00's user avatar
  • 509
22 votes
5 answers
13k views

WordPress Multisite - global categories

Setting up a WP multisite instance - the client has an existing ontology / set of categories that they want to classify all content across the set of blogs. Also the desire is that any new categories ...
anu's user avatar
  • 9,552
20 votes
2 answers
38k views

Get posts from sites in Multisite?

I'm trying to pull multiple sites posts. For example, I can pull out a single site posts by a category and total posts 10. But I'm trying to pull out both posts from two separate Multisite blogs 1 &...
DeadArtcore's user avatar
18 votes
5 answers
9k views

Can I add a Category Metabox to attachment?

I am using register_taxonomy_for_object_type() to add the Category taxonomy field to Media uploads (attachments). I'm using this code to do so: add_action('init', 'reg_tax'); function reg_tax() { ...
Rick Curran's user avatar
  • 1,076
17 votes
4 answers
54k views

How to display related posts from the same category?

Is it possible to display related posts from same category as the current post?
BBee's user avatar
  • 329
16 votes
9 answers
90k views

How To Get Parent Category Slug of Current Post

My theme has styling by category using the following code, which inserts the current category's slug as a CSS class. <div class="CategorySpecificStyle <?php $category = get_the_category(); ...
DLR's user avatar
  • 165
16 votes
3 answers
192k views

How to Display Product specific to a category with WooCommerce Plugin? [closed]

I'm using plugin Woocommerce to do shop online. I have many categories for example shoes, clothes and so on. How can I display the products of specific category? I see such product loops of on the ...
Van Tong's user avatar
  • 163
16 votes
5 answers
13k views

How can I allow commas in tag names?

I want to allow commas in tag names? For example, "hello, world" or "portland, or" but Wordpress keeps separating them. I can do it from the categories page: image http://img839.imageshack.us/img839/...
cwd's user avatar
  • 1,862
14 votes
1 answer
96k views

Display All Products by Category with WooCommerce

With WooCommerce, I want to display all the categories in a store as headings, with all of their products listed below in an unordered list. Is this possible to do? I've seen a few things that'll let ...
JacobTheDev's user avatar
  • 1,221
14 votes
4 answers
2k views

What is the difference between a "tag" and a "category"?

I have been using WordPress for several years, but have yet to see a reason to employ tags over categories or tags with categories. What is the thinking behind the two, and when are each appropriate?
warren's user avatar
  • 281
13 votes
2 answers
141k views

Display current category title on category page

Using the following code in a category template, but instead of showing the current category page that I am on, it displays the first category of the first post. For example on Food category page it ...
NFdesign's user avatar
  • 135
13 votes
3 answers
114k views

How to show related posts by detecting the current category?

In my gallery site i want to show other pictures under the current picture (in single post). I seen more codes but it i asks to specify the category, but i dont want want specify the category manually ...
Felix's user avatar
  • 333
13 votes
3 answers
113k views

WP_Query by a category id and a custom post_type

I need to query all posts that belong to a given category (default, not custom) and a custom post type. As simple as that. The fact that it doesn't work, to me, is ridiculous. Unless I'm missing ...
ᴍᴇʜᴏᴠ's user avatar
13 votes
2 answers
14k views

How to check if I'm on the last page of posts?

I want to display some text on the last page that isn't displayed on the other pages. For example, on category pages: url.com/category/categoryname/page/6 or last page of all posts listed on the ...
user7880's user avatar
  • 131
13 votes
1 answer
6k views

Is there an easy way to make a meta box have the tabs like the Categories meta box has?

My question is pretty much summed up in the title. I'm dropping a meta box in the New Post / Edit Post admin page, and I want to be able to set it up with tabs like the Categories meta box has. I ...
Jason Rhodes's user avatar
12 votes
4 answers
131k views

Get the category from an ID of a product?

I have the ID from a product (1345) how can i get the category name of that specific product? I try $post_categories = wp_get_post_categories( $post->ID ); print_r( $post_categories ); but it ...
Rodrigo Sanz's user avatar
12 votes
2 answers
12k views

How would I get a taxonomy/category list inside a Gutenberg block?

I would like to display a dropdown list of categories (or other taxonomy) inside of a Gutenberg block. I can only think of two ways to do this: Create an array of the taxonomy in php and use ...
JakeParis's user avatar
  • 653
12 votes
5 answers
37k views

Hide specific categories from category widget

I'm trying to hide a large amount of categories from my category widget. I've tried a few plugins but none of them seem to want to let me use the dropdown option. I looked into the ...
FranticJ3's user avatar
  • 169
12 votes
2 answers
3k views

Get rid of Wordpress category, tag and author archives?

I have searched the net with no success on what should be an easy thing. I have a highly customized blog with pages, sub pages and posts. While I rely heavily on the use of categories and tags I don't ...
psot's user avatar
  • 363
12 votes
3 answers
35k views

How to change permalink structure for custom post type and it's taxonomies?

This is a repost of an earlier question I had, but I like to go into more details now to be able to fully solve this. So again, with (normal) posts changing the permalink is as easy as going to ...
Mark's user avatar
  • 1,019
11 votes
5 answers
32k views

Get the first post term

How do I get only the first term of a custom post type. I can get all - no problem. This what I am using to grab all of them <?php foreach ($terms as $term) {echo '<a href="'.get_term_link($...
Sagive's user avatar
  • 2,772
11 votes
5 answers
45k views

Display posts from the same category using next/previous post link

I am using this code, but once I click on the next post/previous post link, I am redirected to the next post/previous post of a different category. previous_post_link( '%link', 'Prev post in ...
user54318's user avatar
  • 401
11 votes
1 answer
80k views

WooCommerce: List All Categories

I'm using the WooCommerce plugin with WordPress and within my theme I'd like to list all categories within a navigation menu with PHP. I've tried using woocommerce_product_categories(); but I don't ...
Edd Turtle's user avatar
11 votes
3 answers
16k views

Check if a post is in any child category of a parent category

In a site I'm developing, I have the following category structure: * movies (parent) * thriller (child) * comedy (child) * drama (child) The current post is in the comedy category. The ...
leemon's user avatar
  • 1,888
11 votes
5 answers
40k views

Can I set a default featured image for a category?

I'm setting up a site with a theme that takes advantage of the "featured image" feature of WordPress. Since my end users are not the most tech saavy in the world, I'd like to set things up so that the ...
Dillie-O's user avatar
  • 1,551
11 votes
4 answers
112k views

How to show all posts of the category in wordpress?

I have create a category by using Custom Post Type plugin, and now only the 5 most recent posts of the category are showing. What I want is to show all posts for the category. For examle, suppose I ...
user avatar
11 votes
2 answers
14k views

Gutenberg editor add a custom category as wrapper for custom blocks

As we know by the provided API from Gutenberg we can create a custom block as const { registerBlockType } = wp.blocks; registerBlockType( 'my-namespace/my-block', { }) but how do I create a ...
fefe's user avatar
  • 874
11 votes
7 answers
43k views

How to export and import taxonomies (category, tag and/or custom taxonomy) and their terms

I want to export all Wordpress categories (no posts, just categories) from one blog to another. How can I do that ?
chubbyk's user avatar
  • 371
11 votes
1 answer
6k views

Force category choice before creating new post?

How can I force the user to first choose a category before continuing to the editor when creating a new post? I want to set some default content, but this is based on the category, so I need to know ...
Jan Fabry's user avatar
  • 30.4k
10 votes
5 answers
67k views

How to get category and archive title?

When I query the category (category.php), how do I get the title of the current category, ie., the one that is being queried? And how do I get the title for tag and date (be it the day, the month or ...
Iacchus's user avatar
  • 213
10 votes
1 answer
25k views

Get category ID from category slug (not working)

I found this code, which apparently gets the category ID from the category slug: $category = get_category_by_slug('category-name'); $id = $category->term_id; But when I try to implement it ...
LBF's user avatar
  • 529
10 votes
1 answer
10k views

How to get permalinks with category base working with sub-categories

I ran into an issue with a site that needs the category base also included in the custom permalink structure. I know this is an issue and I have read many posts like this that gave me some insight... ...
Jeremy's user avatar
  • 450
10 votes
7 answers
25k views

Including categories in search results

I am trying to include categories in search results. I've been searching for hours now with no solution. By "including categories" I don't mean search in a certain category, I mean let's say I have a ...
Yaniv Kossas's user avatar
10 votes
1 answer
18k views

Remove parent category from permalink? Basically only have the child category?

I think there used to be an out-dated plugin to do this. Is there any way to do this easily with just a little code? We prefer not to rely on a plugin since that makes us dependent on the developer ...
dfcode3's user avatar
  • 711
9 votes
6 answers
8k views

How do I remove "Uncategorized" from posts with more than 1 category?

So recently I moved a client from Blogger to Wordpress. When the posts imported from blogger, it saved the blogger "labels" as "tags" in Wordpress. Since I'd like to have these as categories instead, ...
Corey's user avatar
  • 311
9 votes
4 answers
8k views

How to add category to: 'wp-admin/post-new.php'?

I want to have a link to create a new post that sets the category also. I have tried wp-admin/post-new.php?post_category=12 and wp-admin/post-new.php?cat=12, but neither worked. I also tried using ...
A T's user avatar
  • 226
9 votes
7 answers
17k views

Remove the category/taxonomy description field?

How can I remove the category/taxonomy description field? The one which shows up on the edit category/taxonomy page.
Johan Dahl's user avatar
  • 1,343
9 votes
1 answer
1k views

Display random categories on the front page (Finding and Editing Theme Functions)

I'm Currently in the alpha stages of editing a child theme for a Wordpress theme. I do have programing experience and some experience managing wordpress but no direct experience editing wordpress ...
T. Thomas's user avatar
9 votes
2 answers
500 views

Individual rss feed entry length for categories?

I know how to retrieve the rss2 feed from a category in wp, namely adding /feed behind the category name. However when I do this, not all entries from that feed are included in the rss, this is ...
mahatmanich's user avatar

1
2 3 4 5
97