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
- How to influence the information displayed on widget inside wp-admin
- How to add the category ID to admin page
- 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?
- 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?
- Add custom category name as data-filter to switch between these categories
- exclude category from WordPress Form function
- wp_list_categories, Add class to all list items with children
- How to stop wordpress from showing the selected category on top of others in the category selection?
- Render Selected Categories in Admin Edit Post Screen differently
- Can paginate_links() be customized for a specific category or tag?
- Dropdown category filter
- Manipulate Output of wp_list_something: select menu instead of li’s
- How to show in search results posts with a particular tag in a particular category?
- How can I get an tag to wrap each ancestor that gets outputted in this condition?
- Make parent category not selectable when it has child categories
- If category is in parent category?
- Hide posts of a certain category unless logged in
- Add Post Screen Keep Category structure
- If in category to be inside of a function
- How can I enable a TINYMCE rich text editor in the admin interface?
- What’s the Simplest Way to Override/Rewrite the %category% Permalink Structure Tag?
- Filter categories of posts with checkboxes
- How to Filter categories in the permalink structure
- How to display posts under a specific subcategory of a given category
- Taxonomy filter all children
- Filter Home Page Posts in Buddypress [closed]
- Check child/parent categories if exists
- Categorising posts/pages into years published
- Automatically set default password to all posts in a specific category
- How to show only one category in breadcrumb navigation
- get_the_categories filter returns an empty array
- category filter doesn’t work in WPML
- How to filter out Categories for specific post types on WordPress Admin?
- Automatically exclude categories from metabox based on title
- WordPress admin categories sort show is wrong
- 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
- 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
- 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
- Display all product tags associated with a specific product category
- Portfolio Filter Buttons Wont Work
- “Virtual category page” based on a custom field filter
- How to hide some categories in dashboard
- Change post title if post has specific category
- Filter By Category Dropdown List With Custom Taxonomies
- How can I filter posts by tag on the fly
- 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?
- 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?
- 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
- Graphic before title – Specific Category
- Hiding by default posts in given category except for some cases
- Using a template page parent breaks page
- ACF Gallery with Media Categories – how do display categories and sort
- Code to display category-specific single.php is overriding normal single.php, too
- Loop Through Categories in Custom Field
- Custom built theme won’t filter categories
- How to Insert A List of Posts in A Category Written by the Author into the Author Archive
- Anyway to hide a Category in the Categories section when adding/editing a post in WP Admin?
- 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
- Replace category titles inside RSS feed
- Filters do not work when there are multiple (one works)