Last active
February 14, 2023 17:46
-
-
Save someguy9/b1125019308263279ba97193ca30e62e to your computer and use it in GitHub Desktop.
Programmatically update WordPress post https://smartwp.com/wordpress-insert-post-programmatically/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Update a post programmatically | |
$my_post_id = 15 | |
$update_post = array( | |
'ID' => $my_post_id, | |
'post_title' => 'My new post title', | |
'post_content' => 'Overwrite post content', | |
'post_status' => 'public' | |
); | |
wp_insert_post( $update_post ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment