Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * This will create a WordPress page everytime this hook runs. (i.e. When a user is added via WP Zapier plugin)
- * Add the below code to a custom plugin / child theme functions.php
- */
- function my_wp_zapier_create_post_example( $user_id ) {
- $post_data = array(
- 'post_title' => 'The post title via wp_insert_post',
- 'post_content' => 'Place all your body content for the post in this line.',
- 'post_status' => 'publish', // Automatically publish the post.
- 'post_author' => $user_id,
- 'post_category' => array( 1, 3 ) // Add it two categories.
- 'post_type' => 'page' // defaults to "post". Can be set to CPTs.
- );
- // Lets insert the post now.
- wp_insert_post( $post_data );
- }
- add_action( 'wp_zapier_after_create_user', 'my_wp_zapier_create_post_example', 10, 1 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement