The easiest way to do this, is by retrieving the direct parent of the current page category and then use get_category_parents
on that category. Like this:
// supposing $cat contains the category ID
// load category object
$cat_obj = get_category ($cat);
// retrieve parent ID from object;
$parent = $cat_obj->parent;
// retrieve list of parent categories without current category
echo get_category_parents ($parent, true, ' » ');
(Untested but should work)
Related Posts:
- add_action hook for completely new post?
- How can i list current author’s categories?
- How to Make a Category Always Selected?
- anything like add_meta_box for categories?
- Calling clean_term_cache() fails when called in the same plugin that creates terms, succeeds when called separately?
- Missing “category_children” option when dynamically creating categories via a plugin
- Can we create a category list page in WordPress?
- prevent post to have multiple categories in my plugin
- Show add_meta_box by selecting a specific category
- Which are the hooks run before/after when a category’s deletion?
- how do you prevent showing a particular category on the admin dashboard for specific user roles?
- Is it possible to change a term slug before being saved to the database?
- wp_insert_category() setting the ‘cat_ID’ gives not array error
- Send push when new post is published in a certain category
- How do I get the sub categories of the parent when in a sub category?
- Filter Categories widget to allow custom sorting?
- Function/Class to list categories with checkboxes
- How can I show posts for a single category?
- Check if post belongs to any category
- How to display the categories on page using shortcode?
- How to display the category id along with category name on categories list?
- add_action pre_term_description vs. pre_category_description
- WP Dropdown Categories, display subcategories but not grandchildren categories?
- Load stylesheet in edit category page?
- How to relate the Category to user?
- How to exclude categories from get_categories() select list inside a widget admin panel
- How to Show Category List With Corresponding Links?
- Exclude Woocommerce Product Category From Sitemap
- How to show only the last two categories in a menu?
- Determine if term is Category or Tag
- How to check category name available or not
- delete category on plugin deactivation wordpress
- Post is uncatagorized in publish_post action
- Hide post by ‘post_category’
- Woocommerce product not appearing in category list page when created programatically [closed]
- Yoast and another plugin
- Making Woocommerce optimized for more than 500k products
- Add a new tag based on the category name in the publish event
- Creating an archive page listing external data
- How can i call from custom fields to the category editor?
- What method would I use to show an image in between X amount of posts on category archive? [duplicate]
- filter on get_posts efficiently
- How to get recent one post from each category on home page?
- Plugin AJAX Save to Custom Table
- Why enqueue styles on hook?
- How do I change the image from the default mysteryman in the WP Profile page
- Wp-admin Custom User Management
- Dynamically generate meta tags and titles for a wordpress page
- Fatal error: Cannot redeclare admin_notice() [closed]
- Error: Call to a member function get_error_code() on a non-object
- Update wordpress Core Remotely
- How to Add a Custom Size for Thumbnails for WP – Gallery
- Check user’s role and store in variable
- Custom avatars in wordpress comments?
- What’s the hook for filtering every texts of site?
- Make Database query only when option is updated
- Admin Subpages without Menu entry
- Create Widget or Enable Shortcodes in Sidebar
- The Correct Way to Use Nonce Field without Settings API
- Special Formatting for WordPress Plugin Description?
- I am trying to make a page in the admin section similar to the appearance of the Profile page for users
- why do I have to use required parametres?
- Getting a WordPress Debug Strategy
- Include file in plugin file
- Proper way to include stylesheet for panels
- post_title is empty on global $post object
- Inserted double quote when prepending to the_content
- unable to wp_enqueue_script(‘suggest’);
- Plugin development – loading Javascript and Flash
- Meta box on options page save form problem
- Quasi-custom API Call Plugin
- Drawing the line between theme & plugin on large scale bespoke projects
- making a plugin that moves other plugins wp_head actions to wp_footer
- Using add_sub_menu to put into Appearance Section
- WordPress multisite,use same cookies across all website?
- How to check via conditional tags for a single plugin page?
- my basic php code producing unexpected results
- HowTo to add my rewrite rules at the beginning, redirect to the right page and flush the rules on plugin activation?
- Apply styles to blockquote element with the WYSIWYG editor
- Mixing l18n string from my plugin with WordPress’ translations
- How to add search form in main page body?
- Can I use %category% like Templates in my Plugin?
- How to add custom options for plugin into the add post screen – like yoast seo
- WordPress – manually relate a post to page(s)?
- Menu page with minimum capability as ‘Subscriber’ doesn’t allow ‘Admin’ to access it?
- What’s wrong with my usage of add_filter
- Minimum Widget Width for Plugin Development
- Moving/dragging a metabox removes TinyMCE’s content
- Activate theme via plugin script?
- get author of published post
- How can I develop a plugin that generates a page dynamically
- How can I add function calls to my plugin’s options.php default submit routine?
- Error passing post_content to function
- Best/Correct way to add an option to a category
- Remove Default Blogroll Links via Plugin script
- Encoding Method for URLs?
- Store custom meta box data as serialized array
- Catching Gutenberg sidebar switch event
- How To Update WordPress Custom Plugin For Customer? [closed]
- Create page (not the post type) dynamically