By using wp_update_post(), found in wp-includes/post.php:
// Update post 42
$post = array();
$post['ID'] = 42;
$post['post_category'] = array( ... );
$post['post_content' ] = 'This is the updated content.';
$post['post_title' ] = 'This is the updated title.';
// Update the post into the database
wp_update_post( $post );
Related Posts:
- Send an email when custom post type category is changed
- what is the action hook code to supporting product category condition in single product page of woocommerce?
- Remove “Category Archives: title” at the top of a category page [duplicate]
- Display all posts with same title
- Category Descriptions – HTML?
- Prevent function from triggering again when post in specific category gets another category?
- Show Subcategory Description
- Action hooks returning old category instead of new category
- How to display a description of a given category from a custom taxonomy
- Customized title tag for each page in pagination?
- How to get post category title within the loop?
- Single_cat_title() print the title before text
- Code to pull in a PHP file named after the category ID
- How to add custom script to the particular Product Category page
- How to remove the “+Add Category” button from the Category metabox?
- Hide posts of a certain category unless logged in
- in_category() works in single.php but not in page.php?
- Show only one category
- Implementing a tricky wordpress menu (nested categories + thumbnails)
- Taxonomy filter all children
- How to remove “Category : …”
- How to remove category titles?
- Second level subcategory
- Hard coded main navigation
- query in category.php repeats itself
- Move category description below post list in blog
- Applying A Category to Existing Posts Where Page Title Matches Regex
- Counter in loop in foreach
- Woo Framework: woo_cat_featured not populating
- Create menu locations for each category in wordpress
- Different Output for “Every Other” Foreach Statement?
- how to remove the default title of Categories widget
- “Item not updated” when try to change category properties
- How to Remove a Title from All Category and Tags Page?
- WordPress Show Parent Category Description for Sub-categories
- About title on a page
- How to access deleted term inside delete_product_cat action
- Set category page title in custom theme [closed]
- Filter WooCommerce archive pages by an additional category
- Show different title on category page
- Exclude category from foreach loop
- How to load several hierarchical categories from functions.php
- Explode() expects a string
- create function to call category name and slug
- Output Title of Post’s Current Category
- Add Custom Category Description When Empty
- How to hide description on categories and tags?
- Shop Category Pages missing s
- add woocommerce archive description if exist
- How to prevent tag “iframe” from being deleted from the heading description of rubric?
- Include a page’s “category” in its URL
- Get_term_meta() does not work with pre_get_posts()
- How Can I Display the Category Description in a Theme with no Category.php or Archive.php?
- Category name as page title
- Media Library Category Exclude Tree
- Multiple if statements with else for get_the_category [closed]
- Cant get unique_array() work on get_the_category() foreach loop
- How to add Pagination to foreach loop to page
- How to auto update post title and slug with category name when post status is updated
- How can I modify this code to iterate over an array of categories?
- How do you add Author and date Published on Category Pages?
- foreach,having wp_query inside, breaks after showing one result
- Category foreach Paging
- Loops in category description
- Display only the latest post
- Paginating a list of all posts collected by category titles
- Modify functions.php to add a term ‘uses-theme’ set to theme name on post save
- how to display page title only for child category pages
- how to edit wp category widget
- Call Current Category
- Page permalink rewrite
- Fix incorrect related posts code snippet
- Weird html output of single_cat_title – is not inside of the html element?
- How to hide my categories pages’ names, and how as well to reduce the space beween my sidebar’s widgets?
- How to remove “Category:” title prefix in Twenty Sixteen theme?
- List all subcategories from category
- Load custom posts with same tag as page
- How to Set an Individual Homepage for Each User?
- “Reversable” and “Re-useable” Subcategories (or other taxonomic structure)
- Part of title duplicating but not sure how to remove from code – help?
- Custom Tag Description unable to display just below and outside of the Loop
- How to organize custom categories for filtering and selecting
- Functions.php: Exclude Category from “Blog”
- Category images are not displaying in WordPress
- Show child taxonomies (that have posts) of the current parent taxonomy
- Get next post in same category not working WP 4.7.4
- Menu’s breaking, now showing all page links on site
- Link posts together (relative, not grouped)
- Creating a Blog with numerous categories
- Replace deprecated get_category_children code with get_terms
- Retrieving Categories based on the first character of the name
- Ajax load more not working with multipler categories
- Image Upload Custom Form Field for Category and Custom Taxonomy
- get_category display only 1
- Make an array listing custom taxonomy
- Get category id for a custom category and display it in a class
- Include category name in page template
- Categories to A News Page
- Help Me “in_category” with echo? [closed]
- add_action() not working for admin