AutoPost on facebook with conditions

Hi, I would like to use the autoPost on Facebook, but I only want to autopost only if a condition is met, I have a custom Post type, and I want to autopost only if a meta_key value equal to something. Any idea how to do it ? Lets say : if new post meta_key 'cc_add_type' =='pro' then autopost, else don't post. Thanks

  • Jude

    Hi there @Jean-Francois

    Hope you are doing great. There is no pluggable way of doing what you want.

    You need to edit the class_wdfb_public_pages file which can be found in the lib folder. You can add your logic to this line in the code as shown below, replace this code (lines ~611) :

    $post = get_post( $post_id );
    		if ( 'publish' != $post->post_status ) {
    			return false;
    		}

    with this

    $post = get_post( $post_id );
            $meta = get_post_meta( $post_id, "cc_add_type", true );
    		if ( 'publish' != $post->post_status && $meta !=="pro" ) {
    			return false;
    		}

    Thats it !

    Hope this helps

    Cheers
    Jude

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.