You rather need a save_post
hook. Check following code it marks the post sticky for the specified if it is not already.
add_action( 'save_post', 'mark_post_sticky' );
function mark_post_sticky( $post_id ) {
if ( !wp_is_post_revision( $post_id ) && !isset($_POST['sticky']) &&
in_category('bestcategoryever',$post_id) ) {
$_POST['sticky'] = 'sticky';
}
}
Related Posts:
- Using categories & “stickyness” together
- Sticky posts on home page, search, tag and archives without plugin
- Sticky Posts Not Sticking to Top of Category Archive
- Get sticky post from category?
- How to make all posts in a category “unsticky”?
- “Sticky” posts for each category (archive.php)
- Stick multiple posts in a single category
- Sticky posts not working when a specific category is set
- Sticky post for each category on category pages [duplicate]
- How to display sticky or latest published post on the current category page it belongs to?
- Category sticky latest
- How do you get sticky posts to work with categories?
- How to display only sticky posts on category pages?
- How to create a custom sort for WordPress categories
- Hook when category is added to post
- get_categories for custom post type with a specific custom taxonomy attached
- How to add the category ID to admin page
- Multiple Domain Names – One WP Install (non-Multisite) – Default Each Domain name to Category Archive
- Exclude categories from Loop, queries, widgets, post navigation
- Filter categories using tags
- WordPress 1 domain multiple blogs
- Show Post from parent category (custom taxonomy) ONLY!
- One WordPress Install, Two Categories. Each Category Gets a Domain
- Name of last category level for a post
- How to add style to category link?
- WordPress Ordering Problem. How to fix ordering 1-10-100 issue?
- Remove Categories and Tags from Admin Dashboard
- Using widget logic I want to show only a widget on the archive page if there are no posts
- Add a wordpress blog to my website having users
- Allow contributors to add categories, but not delete
- Replace category titles
- PHP Fatal error: Cannot use object of type WP_REST_Response as array in wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
- WordPress categories being called “archives” in google links. How to remove?
- Show recent posts from one category on a non-WP site
- Multiple Category Search
- Omit specific product categories from WooCommerce shortcode
- I want to display posts common in 3 categories [closed]
- Displaying just one new/current post per category in homepage
- How do I share categories across selected sites in a Multisite setup
- Show popular post by category code
- Drop posts from categories in MySql
- Categories in admin interface: can they be collapsible?
- Equivalent to in_category() for subcategories
- query_post order desc
- Exclude category by slug in pre_get_posts?
- list categories based on updated posts [closed]
- How to show 5 posts from specific category on related page?
- How can I only display one link rather than many?
- Hierarchical permalink structure for posts showing categories and sub-categories
- how i can hide some category from author admin panel?
- Exclude category from related post
- Post belonging to many categories
- how do I use the walker class to display categories in their correct heirarchy?
- WP 4.7 in_category change?
- display category list year wise in wordpress
- Echo show_count of categories separately without using wp_list_categories
- Display subcategories in dropdown
- Illegal string offset ‘taxonomy’ in
- Are term_taxonomy_id and term_id the same? [duplicate]
- Display all sub category but one
- Let user select their own category
- Filter Category Loop Dynamically
- SQL query to get posts from multiple categories but not in a category
- Can each user have only access to a private area (his own categories and posts)?
- Pagination breaks on child-categories, works fine on parent-category
- WP Category Meta plugin fix? [closed]
- WP SQL Categories Export and Import
- Category name for all posts getting assigned to a single random post
- How to display WooCommerce category image in my category page banner as a background?
- Why are my newly added categories not showing up when creating a post?
- WordPress Default Category and Custom Taxonomy Selected Attribute not Working After Searched in wp_dropdown_categories Array
- How to add the .html extension to the category?
- Order wp_dropdown_categories by ASC or DESC
- Add filter for specific category only
- How to create category filter on a blog like on the site below?
- How to exclude a category returned by get_categories from function.php?
- Getting a sub category based on a category name
- Conditional statement: if is_category, append at the end of page
- How to Manage and link certain custom taxonomy?
- Store All Post Categories In Array
- How to add an “All” category to the tag cloud?
- I have many different products on my website how can I get them to display under specific categories?
- Help with SQL query, how to add taxonomie terms with value stored in options?
- /blog/ permalink prefix causes category pages to 404
- How to create an array with category ids order by the one that has the most recent post
- Display Referring Category on single post?
- Conditional statements based on custom meta value in category archives
- Placement of categories
- Categories Going to different Blog Pages?
- Display deepest post category, when post have multiple categories
- Paginate WordPress Category Pages
- Get a list of post titles and links from yootheme master theme
- How to structure Multisite sites into categories?
- Template files not working for archives and categories
- Multiple Parent Category URLs
- Excluding cateory not working on my site. how to solve this? [closed]
- Get all first images of posts in same category
- What defines a post as portfolio page content?
- Taxonomy term RestApi data 10 rows limitions
- Replace category titles inside RSS feed