• Resolved kwchanas

    (@kwchanas)


    The system cannot update the meta_key _eg_gallery_data after I added the following code:

    //Purpose: redirect to the post after user created the gallery / album.

    function publishGallery( $ID, $post ) {

    require_once ABSPATH . ‘wp-load.php’;
    require_once ABSPATH . ‘wp-settings.php’;
    global $wpdb;
    $post = get_post( $ID );
    $url = get_permalink($ID);

    if ( $post->post_date != $post->post_modified )
    wp_save_post_revision ($ID);

    wp_redirect($url);
    exit();

    }

    add_action(‘publish_envira’, ‘publishGallery’);
    add_action(‘publish_envira_album’, ‘publishGallery’);

    Do you have any suggestion to solve this problem?

    • This topic was modified 7 years, 2 months ago by kwchanas.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @kwchanas

    Can you tell me if you change the priority on the action if that resolves the issue? It sounds like it’s running before it saves?

    Thread Starter kwchanas

    (@kwchanas)

    Hi @akyusa01

    I changed the priority of the action before, but it can’t resolve the problem.
    add_action(‘publish_envira’, ‘publishGallery’, 500);

    And now, I call the save_meta_boxes function in my program, and the issue has been resolved now!

    include_once( ABSPATH . ‘wp-content/plugins/envira-gallery/includes/admin/metaboxes.php’ );

    $plugin = new Envira_Gallery_Metaboxes;
    $plugin->save_meta_boxes($ID, $post);

    Happy to hear you found the solution @kwchanas ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘meta_key _eg_gallery_data update problem’ is closed to new replies.