Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Meitar

    (@meitar)

    Yes, just use WordPress’s built-in save_post hook, set its priority to run before Tumblr Crosspostr (which uses the default of 10), and overwrite the $_POST['tumblr_crosspostr_crosspost'] superglobal to N (meaning “no, do not crosspost this post”).

    Thread Starter retroriff

    (@retroriff)

    Thanks for answering so quickly. Do you mean something like this?

    add_action( 'save_post', 'tumblr_crosspostr_save', 1, 3 );
    
    function tumblr_crosspostr_save( $post_ID, $post, $update ) {
    	$_POST['tumblr_crosspostr_crosspost'] = 'N';
    	return $post;
    }
    Plugin Author Meitar

    (@meitar)

    Yes, except WordPress actions can’t actually return any data (the PHP function can, but it will not get saved anywhere by WordPress), so you don’t need the return $post; line.

    Thread Starter retroriff

    (@retroriff)

    Sorry, I don’t get it work with that hook. I always get “Yes” by default.

    https://i.imgur.com/Vls4PX1.png

    Plugin Author Meitar

    (@meitar)

    Oh, you’re trying to change the option in the interface, not the save action.

    No, the plugin doesn’t have a GUI-level control for that. You could send me a patch to add one. ??

    Thread Starter retroriff

    (@retroriff)

    Exactly, that’s what I mean.

    I am afraid that I don’t know how to code it.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to change default options?’ is closed to new replies.