Skip to content

Instantly share code, notes, and snippets.

@someguy9
Last active February 14, 2023 17:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save someguy9/b1125019308263279ba97193ca30e62e to your computer and use it in GitHub Desktop.
Save someguy9/b1125019308263279ba97193ca30e62e to your computer and use it in GitHub Desktop.
Programmatically update WordPress post https://smartwp.com/wordpress-insert-post-programmatically/
<?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