I would like to automatically create a post (post type page) upon publishing a new event in event espresso.
Since event espresso events are custom post type events it should trigger for the followign code:
function post_publish() {
// A function to perform actions when a post is published.
// Gather post data.
$my_post = array(
'post_title' => 'My post',
'post_type' => 'page',
'post_content' => 'This is my post.',
'post_status' => 'publish',
'post_author' => 3
);
// Insert the post into the database.
wp_insert_post( $my_post );
}
add_action( 'publish_post', 'post_publish', 10, 2 );
However, it does not.
The code works for normal posts. For example, when I publish a normal wordpress post the snippet is hooked and creates the My post page.
However, it does not work when publishing an event espresso event.
Why not?
The support post ‘Create Post on Publish EE Event’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.
Support forum for Event Espresso 3 and Event Espresso 4.