You should have linked to the original Q&A since the beginning…
Another great code from @JanFabry, btw 🙂
Using exactly the code provided in his answer, this is how to make the filter default_content
work:
add_filter( 'default_content', 'wpse_71772_default_content', 10, 2 );
function wpse_71772_default_content( $content, $post )
{
if( !isset( $_REQUEST['category_id'] ) )
return $content;
switch( $_REQUEST['category_id'][0] ){
// change this to your desired category ID
case'1':
$content="cat 4 content";
break;
case'3':
$content="news content";
break;
default:
$content="default content";
break;
}
return $content;
}
Related Posts:
- Remove “Parent” Selection When Adding/Editing Categories?
- Query posts from category based on a filter most favorited
- Admin comments and user restrictions
- add slug beside name in Admin Category Checklists
- Show parent-child relationship for categories in the wordpress admin
- Get rid of WordPress category, tag and author archives?
- How to influence the information displayed on widget inside wp-admin
- Checklist of selected categories
- Why aren’t sub-categories nested after creating post in the WP Admin?
- How to add the category ID to admin page
- ajax category filter
- Use tag interface for hierarchical taxonomy?
- Filter categories using tags
- Make parent categories not selectable
- Add body class of category parent
- How to create a widgetized sidebar for every category dynamically?
- Remove date and category filters when editing custom post types
- Only show category to certain user levels without plugin
- Moving Categories submenu to Media, but still opens Posts menu
- List Categories of the Parent Category of the Current Category
- Why adding Categories does not auto refresh in Backend while using my custom theme?
- Show only first category name in RSS?
- How to organize custom categories for filtering and selecting
- Filter $cpt categories to omit certain category
- How to set a filter by category within a customised page
- Category control subcategories
- WP admin broken. Not saving catgories or adding categories to menu
- Refine/Filter the Search Results by Category
- WordPress Post # of # filtered by category slug
- Pagination for ajax category filter
- ajax for filtering posts by category in wordpress loops
- How to hide category name
- Add tag parameter to category.php
- Redirect to another page using contact form 7? [closed]
- Random Featured Image Based on Category
- Setting a default text for excerpts of a particular category
- Admin: Navigation Menus do not show empty categories/taxonomies in the list’s search tab
- How to make the ‘delete’ button inactive on some categories?
- Change div background acording to the selected category
- Overriding default calendar to show posts from a category
- How can I display tags as categories?
- Display all product tags associated with a specific product category
- Filter WooCommerce archive pages by an additional category
- Portfolio Filter Buttons Wont Work
- “Virtual category page” based on a custom field filter
- Custom tax_query filter not working for Woocommerce product categories
- How to hide some categories in dashboard
- Change post title if post has specific category
- Filter By Category Dropdown List With Custom Taxonomies
- How to use wp_list_categories with plugin category?
- Using in ‘category_name’ in ‘$query->set();’?
- How can I filter posts by tag on the fly
- Redirect depending on category chosen
- How to add icon over specific thumb
- How to load several hierarchical categories from functions.php
- How to add a custom thumbnail size for a specific category?
- Maintaining a separate posts page for certain categories and don’t show those on home page
- create function to call category name and slug
- Different size video display for category page (smaller) & detail page (larger)
- Exclude posts without category from loop
- How to filter post from categories only if the posts appears in one of them, not the other?
- How to fix select filter on category
- wp_dropdown_categories() works correctly but the list is not filtered in admin for custom post type. What is the problem?
- Add $args to wp_list_categories
- How to hide a category or tag everywhere EXCEPT for use with get_posts
- Add filter for specific category only
- How to create category filter on a blog like on the site below?
- How to filter tags by category?
- Custom Taxonomy Isotope Grid – Filter Buttons Not Working
- How to exclude a category returned by get_categories from function.php?
- Check with Jquery if second level checkbox from categories are checked
- Can’t display posts by filtering categories using isotope.js
- When creating a new product, auto assign it to all custom taxonomy woocommerce
- Correct Hook/Filter to amend category choices on post edit page
- Restrict retrieved terms by category?
- Limit post top level categories to one
- Graphic before title – Specific Category
- Hiding by default posts in given category except for some cases
- Using a template page parent breaks page
- Remove “Category:”
- ACF Gallery with Media Categories – how do display categories and sort
- Code to display category-specific single.php is overriding normal single.php, too
- Custom filters inside a specific category?
- Loop Through Categories in Custom Field
- filter single_cat_title avoiding the breadcrumbs
- Function to list posts from current post’s category fails in WP 3.8
- Right way for setting categories
- Custom built theme won’t filter categories
- Show only one category in main query, issues on tag page
- How to Insert A List of Posts in A Category Written by the Author into the Author Archive
- category filter doesn’t work
- Anyway to hide a Category in the Categories section when adding/editing a post in WP Admin?
- why is the delete option missing from just one category?
- Remove category number fill
- How to create a photo gallery that can be filtered by the image categories
- Remove “?category=” in the URL wordpress ajax filter work for category
- Limit authors on specific catogories
- Replace category titles inside RSS feed
- Filters do not work when there are multiple (one works)
- Fetch Post Category