Best answer

Wordpress Create post (new method)

  • 14 October 2020
  • 2 replies
  • 509 views

Hi, looks like not long ago Zapier closed the possibility of Wordpress (Legacy) post create method. I have to switch to "new" Wordpress post creation (it also requires plugin installation).

I'm wondering whether they Zapier using some REST system to create the posts. Can you please provide more info ? This is because I have some additional code (in my Wordpress) that stopped working

the code is :

function broadcast_wp_insert_post( $post_id, $post )
{
/**
@brief Check for this taxonomy and broadcast to SHT.COM
@since 2018-10-27 15:36:08
**/
$taxonomy = 'post_tag';

/**
@brief Check for this taxonomy term.
@since 2018-10-27 15:36:26
**/

$term = 'ifttted’;

/**
@brief Broadcast the post to these blogs if the tax+term exists.
@since 2018-10-27 15:36:44
**/

$blogs = [ 3 ];
if ( ! function_exists( 'ThreeWP_Broadcast' ) )
return;

// Post must have a specific category.
if ( ! has_term( $term, $taxonomy, $post ) )
return;

// Return an instance of broadcast.
$bc = ThreeWP_Broadcast();

// Don't broadcast if we are already broadcasting.
if ( $bc->is_broadcasting() )
return;

$bc->api()->broadcast_children( $post_id, $blogs );
}
add_action( 'wp_insert_post', 'broadcast_wp_insert_post', 10, 2 );

 

 

 

icon

Best answer by steph.n 21 December 2020, 22:17

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

2 replies

Userlevel 7
Badge +10

Mod note: I’m moving this to “Developer Discussion”.

Userlevel 7
Badge +8

Hey Edward,

Great, thanks for stepping in here. This is helpful. We can POST to a specific URL, assuming that the URL can receive webhooks. This could be accomplished with the Webooks by Zapier app.

Are there additional categories being set, beyond the ones that are created with this Zap step? 

Are they categories that are added later to the WordPress post manually? 🤔

3c0bebc922a713a97c96705a6f7ad9a1.png
(view larger)

If there are other categories being added after the post is published, we can still work with this. You can use a Delay by Zapier step (for X amount of time, depending on how long it takes for the categories to be added), followed by a WordPress "Find Post" action, to look up the current categories, followed by a Webooks by Zapier step, either with a POST action or Custom Request action depending on your needs.

Does this help point you in the right direction? Let me know if you have any other questions or if there's anything else I can do to help you out!

All the best,

Nikki