Update post title with category name after editing a category

The solution I arrived at is using the POST value of the submitted category title, so you always get what you entered and not what was saved before. Like so: function update_group($post_id) { $updates = array( ‘ID’ => 996, ‘post_title’ => sanitize_text_field($_POST[‘name’]) ); wp_update_post($updates); } add_filter(‘edit_category’ , ‘update_group’ );

Archives for each category on WP Multisite

I thought I’d let you know how I resolved this. After some discussion with a colleague, he made the point that adding a trailing year to the url, doesn’t affect the page displayed (I haven’t had time to find out the rationale for this yet) so: /category/subcat/2011/ displays the same page as /category/subcat/ This meant … Read more

List all the categories with or without post

Problem is solved. Just need to add ‘hide_empty’ => false, to the array. Like this : wp_dropdown_categories( array ( ‘orderby’ => ‘name’, // ID of the already selected category: ‘selected’ => 4, ‘hide_empty’ => false, // If no category is selected: ‘show_option_none’ => ‘Choose one’ ) );

RSS/XML of all Categories and/or Tags

Demo plugin for JSON export: I’m not sure the RSS feed structure suits your needs, for example taxonomies and terms don’t have any dates for the public date field. So here’s an example how you can retrieve all the terms for a given taxonomy: /** * Plugin Name: WPSE – JSON export all terms for … Read more

Strip a word from wp_list_categories

I assume you want to replace the “news” string in the category names and not in the category links. The default category walker contains this line: $cat_name = apply_filters( ‘list_cats’, $cat_name, $category ); that allows you to modify the category names that will be displayed. So you could try (untested): <ul class=”subcats-blog”> <?php if ( … Read more