Created
July 3, 2018 11:34
-
-
Save maheshwaghmare/b141623d1853424b7e56a792155f2501 to your computer and use it in GitHub Desktop.
Update bulk post using wp_update_post().
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 | |
| $ids = array(18821,18811,18817,18805,18807,18777,18774,18775); | |
| foreach ($ids as $key => $id) { | |
| $my_post = array( | |
| 'ID' => $id, | |
| 'tax_input' => array( | |
| '<taxonomy-name>' => array( `<tax-id1>`, `<tax-id2>`, `<tax-id-n` ), | |
| ), | |
| ); | |
| // Update the post into the database | |
| wp_update_post( $my_post ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment