BuddyDev

Search

[Resolved] Using code to set category on publishing with BuddyBlog Pay Per Post not working

  • Participant
    Level: Guru
    Posts: 886
    Tosin on #46958

    Hi

    With the latest buddyblog version this code no longer works

    
    /**
     * Assign (Sponsored Post) category to BuddyBlog pay per post articles on checkout.
     */
    add_action( 'bblpro_ppp_post_published', function( $post_id ) {
    	$post_type = get_post_type( $post_id );
    	if ( 'post' != $post_type ) {
    		return;
    	}
    	// Get category.
    	$newcat = get_term_by( 'name', 'Sponsored Posts', 'content_type' );
    	if ( ! $newcat ) {
    		return;
    	}
    	wp_set_post_categories( $post_id, $newcat->term_id, true );
    } ); 
    

    Please note that ‘content_type’ is a custom taxonomy where (Sponsored Posts) category is created

    • This topic was modified 1 year, 6 months ago by Brajesh Singh. Reason: topic title updated from 'BuddyBlog Code not working'
  • Keymaster
    (BuddyDev Team)
    Posts: 24250
    Brajesh Singh on #46962

    Hi Tosin,
    If I remember correctly, the code is related to Pay Per Post plugin.
    The hook was dropped and we will be adding it back. Please check it next week when the Pay Per Post plugin is officially available(by mid next week).

    PS:- Please use relevant titles for your support topics. It helps us as well as others. I appreciate your understanding.

    Regards
    Brajesh

  • Participant
    Level: Guru
    Posts: 886
    Tosin on #46972

    Thanks for the feedback sir, correction noted

  • Keymaster
    (BuddyDev Team)
    Posts: 24250
    Brajesh Singh on #46973

    Thank you.

  • Participant
    Level: Guru
    Posts: 886
    Tosin on #47006

    Kind reminder sir

    Thanks

  • Keymaster
    (BuddyDev Team)
    Posts: 24250
    Brajesh Singh on #47007

    Hi Tosin,
    The plugin is being released this week and we will certainly include the hook back.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 24250
    Brajesh Singh on #47049

    Hi Tosin,
    For the time being, Please change the hook to

    
    bblpro_ppp_post_purchase_completed

    from

    
    bblpro_ppp_post_published
    

    In your code and it should work as expected.

    Regards
    Brajesh

  • Participant
    Level: Guru
    Posts: 886
    Tosin on #47057

    Thanks Brajesh

    This is now resolved

  • Keymaster
    (BuddyDev Team)
    Posts: 24250
    Brajesh Singh on #47060

    You are welcome.

The topic ‘ [Resolved] Using code to set category on publishing with BuddyBlog Pay Per Post not working’ is closed to new replies.

This topic is: resolved