WordPress.org

Ready to get started?Download WordPress

Forums

Front-end Editor
[resolved] save_post equivalent when saving a field (3 posts)

  1. morfie
    Member
    Posted 2 months ago #

    I have a custom 'save_post' action defined in my functions.php which checks the value of a certain post_meta field and based on that value, updates a different post_meta field. This works all nice and happy.
    I am using editable_post_meta() for the post_meta field that needs to be checked. Obviously, when just this one field is saved, it doesn't trigger the 'save_post' action... I'm not saving the whole post, just this field.
    Is there a way to trigger a wordpress action or php function when just that field is saved? Is there a custom action ('save_meta') or something that I can do that will be triggered when this field is updated?
    Thanks.

    https://wordpress.org/plugins/front-end-editor/

  2. morfie
    Member
    Posted 2 months ago #

    Nevermind. I discovered the 'updated_post_meta' action. All good!

  3. morfie
    Member
    Posted 2 months ago #

    For those of you interested

    function functionname($meta_id, $post_id, $meta_key, $meta_value) {
      ...
    }
    add_action( 'updated_post_meta', 'functionname', 10, 4 );

Reply

You must log in to post.

About this Plugin

About this Topic