You can use get_query_var( )
to fetch the current category:
$cat = get_query_var( 'cat' );
You can use this $cat
in the exclude parameter of wp_dropdown_categories( )
to hide the current category:
$args = array(
'show_option_none' => __( 'Select A Category' ),
'show_count' => 1,
'exclude' => $cat
);
wp_dropdown_categories( $args );
Related Posts:
- Dropdown with category selection
- Saving two categories from two dropdowns in front end posting form
- Get id of category from drop down menu
- How to add HTML5 ‘required’ attribute to wp_dropdown_categories() without JavaScripts?
- How to retain the values from dropdown category lists after wrong form submission?
- Help with multiple dropdown tags search
- How to use wp_category_checklist()?
- wp_dropdown_categories and custom taxonomy + custom post type
- How to provide value for ‘selected’ on wp_dropdown_categories() for ‘multiple’ options
- Additional form options based on category selected not working
- wp_dropdown_categories() scripts working erratically on sidebar
- How to use an array of categories as a dropdown?
- How do I display only two categories Instead of displaying all categories
- Dropdown Categories used in form shows no results when all is selected
- Trying to get variables in hacked category dropdown
- wp_list_categories walker without links on categories that have subcategories (to make a nested dropdown menu)
- Filter posts by categories ajax is showing nothing
- WordPress Customizer: Dropdown with Category output
- Filter By Category Dropdown List With Custom Taxonomies
- A dropdown with checklist
- wp_dropdown_categories initial value
- Exclude category from drop down list form
- Trying to get categories and sub-category listing
- Get_term_meta() always returns false
- Woocommerce Category Sort Dropdown
- How to add custom option to wp_dropdown_categories?
- custom browse by
- Get category fixed in dropdown browse categories
- Categories dropdown with all values selected using wp_dropdown_categories
- add custom option to get_categories dropdown
- Taxonomy for custom post type not found
- Form Value of drop down category + Translation of ‘show option none’
- Could not insert term into the database
- How can I get category ID by category name?
- Randomise results from a category page?
- Adding Custom User Profile data based upon Categories
- Only show category to certain user levels without plugin
- Custom Query to search through categories
- Order posts by category name
- How can I make wp_list_categories output li with category-slug as class, for its children?
- Get sticky post from category?
- Remove word “Category” from WooCommerce product page [closed]
- Output link to category from WP_Query loop of woocommerce products
- Display name of the last child category
- If in category to be inside of a function
- How to exclude posts from a category when using this particular format
- Viewing category pages without the word ‘category’ in URL
- Different excerpt styles per category, but chronological
- Show only one category
- Pagination Not Working on Category.php page
- How to view WordPress’ default category IDs?
- Broken category pagination
- how to change template?
- Multiple Domain Names – One WP Install (non-Multisite) – Default Each Domain name to Product Category WooCommerce
- Hard coded main navigation
- one category template for multiple categories
- Display posts separated by Category in Author’s page
- How can I define a custom archive for childs of a specific category?
- The arrangement of categories always change while posting article
- REST API: Display Category names in JSON?
- List posts in alphabetical order
- Where is the category of a post stored?
- Categories list loop – add separator every 3 categories [closed]
- wp_list_pages() exclude category
- How to define multi categories posts number
- Get the ID of 10 Latest Pages stored in a WordPress Category
- Admin: Navigation Menus do not show empty categories/taxonomies in the list’s search tab
- getting post data in functions.php
- how to separate categories in loop.php?
- How can i remove the posts category class names from body_class
- Different Category Headers using in_category and elseif
- Remove the number of posts displayed in wp_list_categories()
- related articles using shortcodes
- Show category meta in loop on homepage
- How to get selected taxonomy or category ID if using custom walker?
- How to hide widget from certain category
- Category link redirect to custom template page instead of index.php?
- Rebuilding a Site: How to Show Several Category Posts in Woo Framework Theme?
- Get post content intro text on category.php?
- Conditional category query breaking?
- Different header for each category
- Unable to browser posts in categories
- 3.1 post formats and specific categories/custom taxonomies
- sidebar troubles, taxonomy trouble
- Duplicate new categories across multisite network
- Inline If statement to echo CSS [closed]
- Template category.php with page (no posts)
- How to create Child Category page from scratch at wordpress?
- How to set featured image as background for a specific category?
- Limit Category/Tag Dropdown To blog_id in Multisite Install With Global Categories/Tags
- Adding relevant categories to related post
- Code to display category-specific single.php is overriding normal single.php, too
- How can I add a Categories page link to a menu? [closed]
- Media Library filter returns undefined function get_current_screen
- Way to show content of a post, but if exceeds character limit revert to excerpt?
- get IDs from links categories
- Display all subcategories for a product category in woocommerce
- Why does my WordPress index has a category?
- Custom EndPoint not working when strip child category in URL
- How to add custom prefix before category base for category page URL?