Advertisement
fauzanjeg

JKIT || Change Post Title By Post ID

May 1st, 2023
1,148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.49 KB | None | 0 0
  1. /**
  2.  * Change Post Title By Post ID
  3.  *
  4.  * Ex: Change Global Template Kit Style Name By Post ID
  5.  *
  6.  * @param number $id The Post ID.
  7.  * @param string $title The New Post Title.
  8.  */
  9. function change_post_title_by_id( $id, $title ) {
  10.     $post_update = array(
  11.         'ID'         => $id,
  12.         'post_title' => $title,
  13.     );
  14.  
  15.     wp_update_post( $post_update );
  16. }
  17.  
  18. /** RUN This Function for Execute || Remove Double-Slash `//` || Change `0000` to Post ID */
  19. // change_post_title_by_id( 0000, 'New Title');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement