{"id":134342,"date":"2021-01-05T20:29:03","date_gmt":"2021-01-05T20:29:03","guid":{"rendered":"https:\/\/wordpress.org\/plugins\/primary-cat\/"},"modified":"2026-01-21T13:41:16","modified_gmt":"2026-01-21T13:41:16","slug":"primary-cat","status":"publish","type":"plugin","link":"https:\/\/lmo.wordpress.org\/plugins\/primary-cat\/","author":23361022,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"0.2","stable_tag":"trunk","tested":"6.8.5","requires":"5.0","requires_php":"","requires_plugins":null,"header_name":"Primary Cat","header_author":"Web Guy","header_description":"Set a primary category for your posts... and then do stuff with it.","assets_banners_color":"675a40","last_updated":"2026-01-21 13:41:16","external_support_url":"","external_repository_url":"","donate_link":"https:\/\/webguy.io\/donate","header_plugin_uri":"","header_author_uri":"https:\/\/webguy.io\/","rating":0,"author_block_rating":0,"active_installs":0,"downloads":1150,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":[],"upgrade_notice":[],"ratings":[],"assets_icons":{"icon-128x128.jpg":{"filename":"icon-128x128.jpg","revision":2450877,"resolution":"128x128","location":"assets","locale":""},"icon-256x256.jpg":{"filename":"icon-256x256.jpg","revision":2450877,"resolution":"256x256","location":"assets","locale":""}},"assets_banners":{"banner-1544x500.jpg":{"filename":"banner-1544x500.jpg","revision":2450877,"resolution":"1544x500","location":"assets","locale":""},"banner-772x250.jpg":{"filename":"banner-772x250.jpg","revision":2450877,"resolution":"772x250","location":"assets","locale":""}},"assets_blueprints":{},"all_blocks":[],"tagged_versions":[],"block_files":[],"assets_screenshots":[],"screenshots":[],"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[2752,610,89,46185,180026],"plugin_category":[57],"plugin_contributors":[247167],"plugin_business_model":[],"class_list":["post-134342","plugin","type-plugin","status-publish","hentry","plugin_tags-breadcrumbs","plugin_tags-categories","plugin_tags-category","plugin_tags-category-slug","plugin_tags-primary-category","plugin_category-taxonomy","plugin_contributors-webguyio","plugin_committers-webguyio","plugin_support_reps-johnmarty"],"banners":{"banner":"https:\/\/ps.w.org\/primary-cat\/assets\/banner-772x250.jpg?rev=2450877","banner_2x":"https:\/\/ps.w.org\/primary-cat\/assets\/banner-1544x500.jpg?rev=2450877","banner_rtl":false,"banner_2x_rtl":false},"icons":{"svg":false,"icon":"https:\/\/ps.w.org\/primary-cat\/assets\/icon-128x128.jpg?rev=2450877","icon_2x":"https:\/\/ps.w.org\/primary-cat\/assets\/icon-256x256.jpg?rev=2450877","generated":false},"screenshots":[],"raw_content":"<!--section=description-->\n<p><a href=\"https:\/\/github.com\/webguyio\/support\">\ud83d\udcac Ask Question<\/a> | <a href=\"mailto:webguywork@gmail.com\">\ud83d\udce7 Email Me<\/a><\/p>\n\n<p>Set a primary category for your posts... and then do stuff with it.<\/p>\n\n<p><strong>Why would I want a primary category?<\/strong><\/p>\n\n<p>Out of the box, WordPress allows you to assign multiple categories to a post. Unless you're enforcing a strict one-category-per-post-only rule for your website, this can be a problem now for displaying the most important category for your respective posts, as opposed to WordPress automatically selecting it for you.<\/p>\n\n<p>Let's say that your blog is about animals, and you publish an article titled \"Why Do Dogs Love Water and Cats Hate It?\" with the categories: <em>Cats<\/em>, <em>Dogs<\/em>, and <em>Pets<\/em> assigned to it.<\/p>\n\n<p>By default, anywhere that WordPress might display a single category to represent the post, it's probably going to display <em>Cats<\/em> by default, but since the post is equally about both cats and dogs, maybe the more general <em>Pets<\/em> category would be more appropriate.<\/p>\n\n<p>This plugin allows you to accomplish that, whether it's for presentational, structural, organizational, SEO, or all of the above purposes.<\/p>\n\n<p><strong>In what ways can I utilize a primary category?<\/strong><\/p>\n\n<pre><code>[primary-cat]\n<\/code><\/pre>\n\n<p>In any creative way that you can imagine, but here are some examples I thought of:<\/p>\n\n<ul>\n<li>To present the main category that the post belongs to above its title (by adding <code>&lt;?php echo do_shortcode( '[primary-cat]' ); ?&gt;<\/code> in your theme code, child theme, or custom functions plugin), in some aesthetic way (which can be styled with CSS <code>.primary-cat<\/code>). Lots of blog, news, and magazine sites have this feature.<\/li>\n<li>To have the appropriate slug in your post URLs if you're using the custom <code>\/%category%\/%postname%\/<\/code> permalink structure under <em>Settings &gt; Permalinks<\/em>.<\/li>\n<li>To have breadcrumbs (by using the shortcode <code>[primary-bread]<\/code>) on your site for user-friendliness (which can be styled with CSS <code>#breadcrumbs<\/code>), and can in turn, also improve SEO.<\/li>\n<\/ul>\n\n<!--section=installation-->\n<ul>\n<li>Install and activate the plugin<\/li>\n<li>Create or edit a post<\/li>\n<li>You'll now be able to set a category as the primary category or add your own custom text<\/li>\n<li>Use the <code>[primary-cat]<\/code> shortcode on any page, post, or text widget or in your theme code, with <code>&lt;?php echo do_shortcode( '[primary-cat]' ); ?&gt;<\/code><\/li>\n<\/ul>\n\n<!--section=faq-->\n<dl>\n<dt id=\"it%27s%20not%20working%3F\"><h3>It's not working?<\/h3><\/dt>\n<dd><ul>\n<li>It's fully compatible with the classic editor, and I'm working on adding full support for the block editor too.<\/li>\n<li>You can enter whatever text you like into the Primary Category field to represent your post, and it's not even required to actually be a registered category. However, for certain features to work right, like overriding the category slug in URLs, it needs to also be an actual category.<\/li>\n<li>You may need to flush the permalinks by going to <em>Settings &gt; Permalinks<\/em> and clicking on \"Save Changes.\"<\/li>\n<li>You may need to clear any caches and refresh your browser.<\/li>\n<\/ul><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>0.2<\/h4>\n\n<ul>\n<li>Minor code cleanup<\/li>\n<\/ul>\n\n<h4>0.1<\/h4>\n\n<ul>\n<li>New<\/li>\n<\/ul>","raw_excerpt":"Set a primary category for your posts... and then do stuff with it. [primary-cat]","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/134342","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=134342"}],"author":[{"embeddable":true,"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/webguyio"}],"wp:attachment":[{"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=134342"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=134342"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=134342"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=134342"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=134342"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=134342"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}