• Hello sirs,
    first of all your plugin rocks.
    I have an issue , and although it seems pretty “funny” I am struggling with this.

    I am trying the following function

    function skip_the_updates($continue_import, $data, $import_id)
    {
        
        if ($import_id == 3) { // The number is 3 
            if (1 == 1) {
                return true;
            }
            // Don't update this post
            return false;
        }
    }
    
    // Apply the code to posts set to be updated.
    add_filter('wp_all_import_is_post_to_update', 'skip_the_updates', 10, 3);

    As you can see I use a dummy conditional in order to make it work however… It does not see the $import_id first. It seems that it does not work.

    Even if I put 1==2 or 1==1 the outcome is the same?
    Do you know why that happens?
    Do you know if I could find the solution if I enable the error log?

    Thanks a lot!
    Archimidis

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author WP All Import

    (@wpallimport)

    Hi @archimidism,

    The ‘wp_all_import_is_post_to_update’ hook actually has 4 parameters, so you need to change the “add_filter” call to this:

    add_filter('wp_all_import_is_post_to_update', 'skip_the_updates', 10, 4);

    Then, change your function to this:

    function skip_the_updates($continue_import, $post_id, $data, $import_id)

    That will fix your $import_id check and make the code work for import ID 3. However, you should add a line after the import ID check so that other imports work:

    return $continue_import;

    Thread Starter Archimidis Mertzanos

    (@archimidism)

    Oh thanks a lot for your comment.
    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Problem with wp_all_import_is_post_to_update hook’ is closed to new replies.