• Hi, I need to open a prompt when editing a post.

    With this code I’m able to update post meta:

    function duvod( $post_id, $post )
    {
    	if ( wp_is_post_revision( $post_id ) || $post->post_type != 'inzerat' )
    		return;
    
    		update_post_meta($post_id, 'duvod_odmitnuti', 'vsuk');
    
    }
    add_action( 'save_post', 'duvod', 10, 2 );

    But when I try to change it – open a javascript prompt or php echo but none of them is working.

    Is there any restriction when using the ‘save_post’ action?

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    No restriction really, at least of the kind that causes errors when violated, but any code that tries to output to the browser will not succeed. It’s not what the action was meant for. I suggest you code some javascript to open your prompt on the click event of the update button.

    I believe there’s is a way to tap into the edit page’s messaging — the “Post updated. View post.” sort of message, but that’s all I know about it.

Viewing 1 replies (of 1 total)
  • The topic ‘Prompt on post_save’ is closed to new replies.