I’ve found a workaround by forcing the second refresh, but I’m sure there’s probably a better way to do this.
In order to make the process smoother for the user, I’m thinking I’ll have to do an AJAX post and then refresh on success to show the updated data.
if ( isset($_POST['deleteSelectedCategories']) ){
$cats = $_POST['catsToDelete'];
$catsArray = explode(',', $cats);
$success = 0;
foreach ($catsArray as $catID) {
if ( wp_delete_term( $catID, 'category' ) ) {
$success++;
}
}
if ($success > 0) {
echo '[Here I have some HTML to block out the screen
and show a message to the user,
and then the following meta refresh:]
<meta http-equiv="refresh" content="0" />';
}
}
Related Posts:
- Gutenberg editor add a custom category as wrapper for custom blocks
- How can I hide a category from Contributors in the edit/add new post screen?
- WordPress Multiple Category Search
- How to remove categories filter from wordpress admin?
- Decreasing the Memory Consumption of a WordPress Site?
- Multiple Domain Names – One WP Install (non-Multisite) – Default Each Domain name to Category Archive
- How can I select a primary category?
- how to use a different domain/subdomain for authors/catagories on single site?
- Deleting default category in wordpress
- Delete a specific category when deleting a user
- How to list child categories in custom category template?
- Trash bin for categories
- How to set up sub-categories for author pages?
- View category in the preview of Theme Customizer
- One WordPress Install, Two Categories. Each Category Gets a Domain
- Block multiple categories from Blog
- How to have a static category/author page?
- Create single.php for specific category by category id
- Show posts of one category only with Custom Taxonomy on single.php
- Save metabox checkboxes values to custom content type
- Select category in custom query
- Remove “Parent” Selection When Adding/Editing Categories?
- Order Taxonomy Term by date created
- Apply custom category template to subcategories
- Hide post meta data on a specific category
- Format Brand value in Category view [closed]
- Add custom taxonomy under the category title
- How to show in search results posts with a particular tag in a particular category?
- What is the advantage of using header-catname.php over is_category(‘catname’);?
- Remove ‘rel’ attributes from the_category() output
- Multiple menu items highlighted
- in_category() works in single.php but not in page.php?
- Use a wordpress page to display a certain category
- How to view WordPress’ default category IDs?
- Multiple Category Search
- How do I add a function on a specific post category?
- How to customize category template?
- Category-slug.php not being used
- How would I go about adding custom header images per category?
- Automatically exclude categories from metabox based on title
- Display posts separated by Category in Author’s page
- How to categorize posts under Category 1 and Category 2 which are separate lists of categories, and display them as separate lists in widgets
- How to organize custom categories for filtering and selecting
- Filtering *out* a taxonomy from the admin post list
- How to rewrite the post URL according to the category?
- How to build a simple nav system of custom post type categories and its posts?
- Display thumbnails for certain category posts
- Keyword search in multiple categories
- Is it possible to remove from default category widget?
- How to customize my category pages
- How to make the ‘delete’ button inactive on some categories?
- Two columns in homepage each with one category
- Multiple selection for wordpress widget
- Different CSS class by category
- how to nest specific category thumbnails inside different containers
- Wrong category nice name is displayed on archive page
- How can i change what one category displays?
- Remove any product that is featured from regular display loop [WooCommerce]
- Two Sections on Woocommerce Catergory Page [closed]
- How to let the user create a selection of categories via the backend
- Theme for subcategories
- Add code to header based on category for specific posts?
- Custom css per category and per single post belong in each category
- How to hide widget from certain category
- custom query for both category and pages using global $wpdb;
- I would like to feature a tip on the homepage
- How to add icon over specific thumb
- Problem with Custom Post Type Categories
- List post only under the category, exclude child category content
- SQL query to get posts from multiple categories but not in a category
- wp_delete_term or wp_delete_category?
- Select posts that match multiple category names, must match all categories listed
- Custom Portfolio Page
- Last x Posted Categories?
- I need advice on how to structure the categories according to the layout i have
- show only sub categories if available?
- How to add meta description, keywords, custom title to a category template
- separate posts to have (kind of) 2 blogs?
- problem with filter of custom portfolio categories
- How can I make a category function as a page?
- Category custom template is not showing correct posts
- Search Replace Database ONLY for posts of certain category?
- Default URL for category dropdown select option
- Filter custom taxonomy posts via AJAX
- Need help to structure our a complex hierarchy
- Inserting categories as a hierarchical terms from frontend form
- Show posts from all categories
- How to add a post with new Taxonomy without assigning to default category?
- Getting page/category content to show up in my custom page template
- How do you add Author and date Published on Category Pages?
- If it is a top level category show children otherwise show sibling categories
- Own Custom Tags/Category page ( posts)
- Gettind 404 not found wen click the view button for a given category custom post type portfolio
- How to create default categories in new installs?
- display certain category on custom template page
- List all authors by matching custom meta data on a category page
- why is the delete option missing from just one category?
- How to prevent page re-sizing for mobile browsers [closed]
- Custom permalinks structure
- Woocommerce custom taxonomy order