0
Je veux déclencher une fonction dans mon Wordpress lorsqu'un post personnalisé planifié publiera. Malheureusement, il n'y a pas de crochet d'action par défaut pour custom_post_type
.Action crochet pour la publication personnalisée comme publish_future_post
Voici l'exemple de code de mon plugin:
function connectwpblog123() {
if(defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
return;
$post_status = 'publish';
$movie_post1 = array();
$movie_post1['post_title'] = 'Schedule Test Example';
$movie_post1['post_type'] = 'fbtweets';
$movie_post1['post_content'] = 'Abce defgh i gk lmno p qr st';
$movie_post1['post_status'] = $post_status;
$movie_post1['tags_input'] = array(1);
$movie_post1['post_category'] = array(1);
$post_id = wp_insert_post($movie_post1);
}
add_action('publish_future_fbtweets', 'connectwpblog123', 10, 1);
Quand je brancher mon post personnalisé à l'aide publier crochet post personnalisé:
add_action('publish_post', 'connectwpblog');
Cela déclenche la fonction pour un temps infini.
S'il vous plaît aider .... –