Title: Xpath 2.0?
Last modified: March 28, 2020

---

# Xpath 2.0?

 *  Resolved [monkeydude50](https://wordpress.org/support/users/monkeydude50/)
 * (@monkeydude50)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/xpath-2-0/)
 * Hi There,
 * I’ve been trialing this plugin and am very impressed with its features. I have
   csv files that I need to import on a daily basis with 10000+ products. No matter
   what try regarding server php settings, the import takes forever and usually 
   fails around 50%.
 * I’ve realised that not all of the products from the file need to be pulled every
   day just the ones that have been updated (reducing the import size significantly).
   There is a last “modified column” in my file and I’m trying to filter that for
   today’s date with xpath. However it seems as though getting today’s date is only
   available in xpath 2.0. Does Wp All Import support that?
 * Kind Regards,

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

 *  Plugin Author [WP All Import](https://wordpress.org/support/users/wpallimport/)
 * (@wpallimport)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/xpath-2-0/#post-12607854)
 * Hi [@monkeydude50](https://wordpress.org/support/users/monkeydude50/)
 * > No matter what try regarding server php settings, the import takes forever 
   > and usually fails around 50%.
 * Please try optimizing your import by following this guide: [https://www.wpallimport.com/documentation/troubleshooting/slow-imports/](https://www.wpallimport.com/documentation/troubleshooting/slow-imports/).
   Also, if you’re importing images, you should disable image optimization plugins
   during the import.
 * If it still terminates after that, please see: [https://www.wpallimport.com/documentation/troubleshooting/terminated-imports/](https://www.wpallimport.com/documentation/troubleshooting/terminated-imports/).
 * > There is a last “modified column” in my file and I’m trying to filter that 
   > for today’s date with xpath. However it seems as though getting today’s date
   > is only available in xpath 2.0. Does Wp All Import support that?
 * Unfortunately, we currently only support XPath 1.0. However, you could use the
   wp_all_import_is_post_to_update/create hooks to only import posts that meet your
   criteria: [https://www.wpallimport.com/documentation/developers/code-snippets/#filter-posts-by-date](https://www.wpallimport.com/documentation/developers/code-snippets/#filter-posts-by-date).
    -  This reply was modified 6 years, 1 month ago by [WP All Import](https://wordpress.org/support/users/wpallimport/).
 *  Thread Starter [monkeydude50](https://wordpress.org/support/users/monkeydude50/)
 * (@monkeydude50)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/xpath-2-0/#post-12614623)
 * Hi There,
 * Thanks for letting me know. I have tried everything with regards to changing 
   my php settings on the server etc and no luck the import still takes a very long
   time and times out a lot of the time. I’m using a dedicated server too so the
   hosting is powerful. Any ideas?
 * I have another question regarding importing attributes for woocommerce – my csv
   file passes product attribute names and values in the rows as opposed to fixed
   header titles – due to the amount of products and large variations in type. I
   managed to successfully import these by selecting “don’t update attributes only
   create new ones” – this stops the attributes from being overwritten and instead
   appends them. However if an attribute changes in my file for example there is
   mistake and it’s corrected with an update this wouldn’t then update that data
   would it?
 * Kind Regards,
 *  Plugin Author [WP All Import](https://wordpress.org/support/users/wpallimport/)
 * (@wpallimport)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/xpath-2-0/#post-12636157)
 * Hi [@monkeydude50](https://wordpress.org/support/users/monkeydude50/)
 * > I have tried everything with regards to changing my php settings on the server
   > etc and no luck the import still takes a very long time and times out a lot
   > of the time. I’m using a dedicated server too so the hosting is powerful. Any
   > ideas?
 * For the speed, try this guide: [https://gist.github.com/trey8611/72fec5969651d5272fcb85f99b09b8bb](https://gist.github.com/trey8611/72fec5969651d5272fcb85f99b09b8bb).
 * For the terminations, what did your web host find in the error logs on the server?
   We’ll need the relevant entries to advise on that.
 * > However if an attribute changes in my file for example there is mistake and
   > it’s corrected with an update this wouldn’t then update that data would it?
 * Unfortunately, you’re right, when using the “Don’t touch existing Attributes,
   add new Attributes” option it won’t delete the attribute term that was created
   on a previous run of the import. The only way to do that would be to update all
   attributes, or update the attribute terms directly.
 *  Thread Starter [monkeydude50](https://wordpress.org/support/users/monkeydude50/)
 * (@monkeydude50)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/xpath-2-0/#post-12650434)
 * Hi Again,
 * I’ve swtiched to a new dedicated server (more powerful) to try it out. This time
   the import was taking so long that I just cancelled it. This file is 4mb and 
   contains only attributes for the products (no images) and has 60,000 rows. It
   took 5 hours to reach 10% (6000) updated. Is this a normal expected speed for
   this type of import? Is there potentially a better way, for example importing
   attributes as custom fields or something. I simply want to show the attributes
   on the product screen and filter using them.
 * Again anything you could recommend regarding updating the attributes considering
   both the attribute label and value are passed in my file?
 * Kind Regards,
 *  Thread Starter [monkeydude50](https://wordpress.org/support/users/monkeydude50/)
 * (@monkeydude50)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/xpath-2-0/#post-12663995)
 * Just an update on this,
 * I’m now thinking filtering using php is the best way to go and I’ll see how quick
   it is with much less records being imported. Is it possible using php to only
   import records that are newer than a date in my products? My files have a last
   modified date and if I import that to the product or to a custom field in the
   product could I only import records that compare to that date and if it doesn’t
   exist or the date is older then import?
 * Also using php is it possible for me to script it so my attributes file will 
   work the way I need? So it appends all the attributes in the file firstly when
   creating and then if updating will update the attributes without keep existing
   values?
 * Kind Regards,
 *  Plugin Author [WP All Import](https://wordpress.org/support/users/wpallimport/)
 * (@wpallimport)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/xpath-2-0/#post-12668963)
 * Hi [@monkeydude50](https://wordpress.org/support/users/monkeydude50/)
 * > This file is 4mb and contains only attributes for the products (no images) 
   > and has 60,000 rows. It took 5 hours to reach 10% (6000) updated. Is this a
   > normal expected speed for this type of import?
 * No, that doesn’t seem normal, it seems quite slow. Did you see any improvement
   when you tried the steps in the second guide I sent you?
 * > Is there potentially a better way, for example importing attributes as custom
   > fields or something. I simply want to show the attributes on the product screen
   > and filter using them.
 * Importing them as custom fields should be much faster, but you’d need a plugin
   like FacetWP to be able to filter using them.
 * That said, if the problem is a conflicting plugin/theme, the import could still
   be slow. I’d strongly suggest [setting up a staging copy of your site](https://themeisle.com/blog/wordpress-staging-site/)
   so that you can test everything in the slow import guide I sent you.
 * > Is it possible using php to only import records that are newer than a date 
   > in my products? My files have a last modified date and if I import that to 
   > the product or to a custom field in the product could I only import records
   > that compare to that date and if it doesn’t exist or the date is older then
   > import?
 * Yes, you can modify the example snippet I sent you previously to do that: [https://www.wpallimport.com/documentation/developers/code-snippets/#filter-posts-by-date](https://www.wpallimport.com/documentation/developers/code-snippets/#filter-posts-by-date).
 * > Also using php is it possible for me to script it so my attributes file will
   > work the way I need? So it appends all the attributes in the file firstly when
   > creating and then if updating will update the attributes without keep existing
   > values?
 * It would probably be possible to write a custom solution for that using [our API](http://www.wpallimport.com/documentation/developers/action-reference/),
   but I’m afraid I do not have an example snippet for this specific use case.
 * Is it possible for you to include all of the attributes in your file? That way
   you could just use “Update all attributes” and it will add/remove attributes 
   as needed.
 *  Thread Starter [monkeydude50](https://wordpress.org/support/users/monkeydude50/)
 * (@monkeydude50)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/xpath-2-0/#post-12677290)
 * Great thank you,
 * Modifying that code snippet should be an ideal solution for me then to filter
   the records. I had a go at trying to modify the code, I changed the column number
   to the correct one and instead of the target date I put a reference to a custom
   field where my date is stored but this didn’t seem to work. I’m just about to
   purchase the Premium plugin with acf add ons. Would you give support on how to
   do this?
 * I’m going to install the premium version and then try the speed improvement guide,
   specifically the post id matching instead of sku matching as I think that together
   with my filtered records should mean a smaller quicker import.
 * Regarding the attributes, sorry I’m not sure I’ve been clear on what I mean or
   how they are passed in the file. I’ve uploaded some images to imagebb to show
   what I mean. This is how attributes are passed in my file – [https://ibb.co/syT4zwB](https://ibb.co/syT4zwB)–
   the attribute_label column contains the names of the attributes and attribute_value
   contains the values – [https://ibb.co/7kV3Sb0](https://ibb.co/7kV3Sb0). If I 
   select update all attributes as normal then this happens – [https://ibb.co/gv17hQf](https://ibb.co/gv17hQf)–
   it overwrites each attribute with the next, only ever keeping one. If I select“
   Don’t touch existing Attributes, add new Attributes” then I get the desired result
   and the attributes append and store all of them – [https://ibb.co/7gM6PDM](https://ibb.co/7gM6PDM)
 * The only problem with that option is if there’s an issue with an attribute it
   won’t update it. I hope that makes sense? What would you recommend to get that
   functionality?
 * Kind Regards,
 *  Plugin Author [WP All Import](https://wordpress.org/support/users/wpallimport/)
 * (@wpallimport)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/xpath-2-0/#post-12693930)
 * Hi [@monkeydude50](https://wordpress.org/support/users/monkeydude50/)
 * > I changed the column number to the correct one and instead of the target date
   > I put a reference to a custom field where my date is stored but this didn’t
   > seem to work. Would you give support on how to do this?
 * Unfortunately writing/troubleshooting custom code for your project is beyond 
   the scope of our support. You’ll have to work with a developer to get the code
   working with your data.
 * > The only problem with that option is if there’s an issue with an attribute 
   > it won’t update it. I hope that makes sense? What would you recommend to get
   > that functionality?
 * Thanks for the images. Unfortunately, we don’t have built-in options to do what
   you’re wanting in this scenario, because WP All Import isn’t going to touch the
   existing attributes.
 * If you’re not able to come up with a custom code solution, you’ll have to export
   the products when an attribute needs removed/changed, update the attributes in
   the file, then import the changes using the “Import with WP All Import” feature:
   [https://d.pr/i/fWEWU2](https://d.pr/i/fWEWU2).

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

The topic ‘Xpath 2.0?’ 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/)

## Tags

 * [Import](https://wordpress.org/support/topic-tag/import/)
 * [xpath](https://wordpress.org/support/topic-tag/xpath/)

 * 8 replies
 * 2 participants
 * Last reply from: [WP All Import](https://wordpress.org/support/users/wpallimport/)
 * Last activity: [6 years, 1 month ago](https://wordpress.org/support/topic/xpath-2-0/#post-12693930)
 * Status: resolved