trigger rwmb_after_save_post manually

Support General trigger rwmb_after_save_post manually

  • This topic has 3 replies, 2 voices, and was last updated 1 week ago by PeterPeter.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #49646
    aryanrajaryanraj
    Participant

    Hi, i have few read only fields for a post type "books". it saves the current post id in read only field. the field value was deleted manually in database.

    I want to trigger rwmb_after_save_post which i use to save the field again with the value.

    Quick Edit is not working and i need to manually edit each post, clicking on Update.

    I have plan to import more books without having their id so i want it to trigger so it autofill that field which saves the each book id.

    #49654
    PeterPeter
    Moderator

    Hello,

    I'm afraid that it isn't possible. The action hook rwmb_after_save_post will be triggered after the post is saved. If you want to update the field value with the post ID after importing data with WP All Import, you can try to use their hook to update field value:

    
    add_action( 'pmxi_saved_post', function ( $post_id ) {
        update_post_meta( $post_id, '_my_read_only_field', $post_id );
    } );
    

    or create an SQL query to update field value manually in the database.

    #49658
    aryanrajaryanraj
    Participant

    I manually uploaded through database using tableplus. I wonder if we can have anything that would click update button of the post so the rwmb_after_save_post run without touching each post.

    #49664
    PeterPeter
    Moderator

    Hello,

    Then I don't have any idea how to trigger an action hook when importing data directly to the database. You can contact TablePlus support and ask them for more information.

    Thanks.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.