I am trying to make a post sticky on publish or update based on a custom field. I use the code below but it doesn't work.

What am I doing wrong?

function stick_post_on_save( $post_id ) {

    $ed_plus = get_post_meta( $post_id, 'ed_plus', true );

    if ( $ed_plus ) {   
add_action( 'save_post', 'stick_post_on_save' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.