Title: Skip record
Last modified: April 1, 2024

---

# Skip record

 *  Resolved [Alexandros](https://wordpress.org/support/users/alprio/)
 * (@alprio)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/skip-record/)
 * Hello ,
   I want to add a function to skip certain records that have a custom value
   but this function must run for a particular import id.
 * i added this code , but even if i run another import id , for example import 
   id 20 , the function fires. 
   even if i havent add the custom value still fires.
 * what am i doing wrong ?
 *     ```wp-block-code
       function is_post_to_update($continue_import, $postid, $data, $import_id) {
           // Retrieve the import ID while the import is running.
           $import_id = wp_all_import_get_import_id(); 
   
           // Check for your import
           if ($import_id == 18) {
               $do_not_update = get_post_meta($postid, 'do_not_update', true);
               if ($do_not_update == true) {
                   return false;
               }
               return true;
           }
       }
       add_filter('wp_all_import_is_post_to_update', 'is_post_to_update', 10, 4);
       ```
   
 * 
   Thank you.
    -  This topic was modified 2 years, 2 months ago by [Alexandros](https://wordpress.org/support/users/alprio/).

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [WP All Import](https://wordpress.org/support/users/wpallimport/)
 * (@wpallimport)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/skip-record/#post-17549368)
 * Hi [@alprio](https://wordpress.org/support/users/alprio/),
 * We can’t really help troubleshoot custom code, but one thing I noticed is that
   your code isn’t returning the original $continue_import value after the IF conditional.
   It should be something like this:
 *     ```wp-block-code
       function is_post_to_update( $continue_import, $postid, $data, $import_id ) {
       	// Some code here, including an IF conditional
   
       	// Outside of the IF conditional, return the original value
       	return $continue_import;
       }
       add_filter( 'wp_all_import_is_post_to_update', 'is_post_to_update', 10, 4 );
       ```
   
 *  Thread Starter [Alexandros](https://wordpress.org/support/users/alprio/)
 * (@alprio)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/skip-record/#post-17554481)
 * i found a solution .
 *     ```wp-block-code
       function my_is_post_to_update( $continue, $post_id, $xml_node, $import_id ) {
           // Run this code on a specific import
           if ($import_id == '18') {
               // Check if the custom field 'do_not_update' has a value of 'yes'
               $do_not_update_attr = get_post_meta( $post_id, 'do_not_update_attr', true );
   
               // If 'do_not_update' is set to 'yes', don't update this post
               if ( $do_not_update_attr === 'yes' ) {
                   return false;
               }
           }
   
           // Continue with the default behavior (update the post)
           return $continue;
       }
   
       add_filter( 'wp_all_import_is_post_to_update', 'my_is_post_to_update', 10, 4 );
       ```
   
 * Thank you !

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Skip record’ is closed to new replies.

 * ![](https://ps.w.org/wp-all-import/assets/icon-256x256.png?rev=2570179)
 * [WP All Import – Drag & Drop Import for CSV, XML, Excel & Google Sheets](https://wordpress.org/plugins/wp-all-import/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-all-import/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-all-import/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-all-import/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-all-import/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-all-import/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Alexandros](https://wordpress.org/support/users/alprio/)
 * Last activity: [2 years, 2 months ago](https://wordpress.org/support/topic/skip-record/#post-17554481)
 * Status: resolved