• Resolved mi5

    (@mi5)


    I’m trying to make import/update profile for only specific posts.
    For instance, posts with certain custom attribute or some other condition.
    I researched documentation and WP All Import Action Reference but not finding action in which I have available post_id and import_id.
    What would be the way to do such a thing?

    https://www.ads-software.com/plugins/wp-all-import/

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

    (@wpallimport)

    Hey mi5,

    If this is a new import then you could simply filter your data using the available filter options on step 2 of the import: https://www.wpallimport.com/documentation/advanced/filtering-with-xpath/

    If you are doing this on an existing import and you want to programatically decide if a post should be updated, then you can do this using the “wp_all_import_is_post_to_update” filter. Scroll down to the very bottom of this page: https://www.wpallimport.com/documentation/advanced/action-reference/

    That filter broadcasts the XML node for the current item being processed as well as the post ID for the post that would be updated. You can use those two items to compare data and decide if it should be updated or not.

    Thread Starter mi5

    (@mi5)

    Thank you for your prompt response!
    I plan to do this on an existing import (posts are already in the database) so I think using the “wp_all_import_is_post_to_update” filter would be the correct route…
    Is there a way to programmatically determine the import ID or name of the XML file within the function? I would like to limit the filter to only specific import profile. I have other profiles, for which I do not want to apply the filter.
    I understand as regards XML node but since it is an external source I do not have ability to manipulate its content.

    Plugin Author WP All Import

    (@wpallimport)

    You can access the import ID is with $_GET[‘id’] on a manual run and $_GET[‘import_id’] with cron execution.

    Thread Starter mi5

    (@mi5)

    Great, thanks!
    I’ll try that.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Import profile for only specified posts / products’ is closed to new replies.