Created
September 27, 2017 20:43
-
-
Save JiveDig/22ae7769553da993e6c92b60925a3c3a to your computer and use it in GitHub Desktop.
Starter code to create a new Favorite for use with Mai Favorites plugin (https://maipro.io)
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 | |
$favorite_id = wp_insert_post( array( | |
'post_author' => 1, | |
'post_excerpt' => '', | |
'post_status' => 'publish', | |
'post_title' => '', | |
'post_type' => 'favorite', | |
'_thumbnail_id' => '', | |
'meta_input' => array( | |
'url' => '', | |
'button_text' => '', | |
), | |
) ); | |
if ( $favorite_id && ! is_wp_error( $favorite_id ) ) { | |
wp_set_object_terms( $favorite_id, array(), 'favorite_cat', true ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment