Forums › Forums › Search & Filter Pro › Wp all import – taxonomies not updated
- This topic has 8 replies, 1 voice, and was last updated 6 years, 8 months ago by Trevor.
-
Anonymous(Private) April 3, 2018 at 9:09 pm #169773
Hi!
I have searched through your support forum and it seems that others are also experiencing the same issue as me, however, their posts are one year old, so I just want to see if you have come up with a new solution.
I am importing products via Wp All Import.
When I import products and their taxonomies, the right taxonomies are assigned to the right products, but you cannot see this on the front-end. However, if you go to the product/post and update it manually without touching anything but the update button, the taxonomy will show on the front-end.
Can you help me out? is it still an issue with the update of the cache?// Jannik
Trevor(Private) April 4, 2018 at 8:54 am #169883You would, I think, need to make sure you are using a child theme (Orbisius have a simple, free plugin to make one of these from your theme). In the child theme functions.php, you would require this code:
add_action('pmxi_saved_post', 'wp_all_import_post_saved', 10, 1); function wp_all_import_post_saved($id) { do_action('search_filter_update_post_cache', $id); }
Please test this and see if it works for you?
Anonymous(Private) April 4, 2018 at 10:15 am #169917It is a custom post type i have though, so maybe i will need to tweak it the following way?
<?php
add_action(‘pmxi_saved_post’, ‘post_saved’, 10, 1);function post_saved($id) {
$x = get_post_meta($id, ‘your_meta_key’, true);
// do something with $x
update_post_meta($id, ‘your_meta_key’, $x);
}?>
Trevor(Private) April 4, 2018 at 10:19 am #169921This will only fix newly updated posts, not ones already imported. Are you saying it does not work for newly imported data? I know it has worked in the past, as another user has used the same code, which is based on a code sample in the WP All Import developer API guide.
Anonymous(Private) April 4, 2018 at 10:41 am #169938Hi again Trevor!
Thank you again for your help, i really do appreciate it!I just tested it again, and it works in this way:
When I import NEW products via Wp All Import, the taxonomies are not going to be attached before I manually push update/publish on the individual post. HOWEVER, if i run the Wp All Import again, all the products which are already in the system are getting their taxonomy assigned in the right way, and it can now be seen on the front-end. You could say, that it is a workaround, but it is not the best way to have a Wp all Import run twice every time. Do you have any idea how to make it work for new products and not only existing products?Best regards
Trevor(Private) April 4, 2018 at 2:35 pm #169997You can see their documentation here:
http://www.wpallimport.com/documentation/advanced/action-reference/
If you added an echo to the function, to echo the post ID to the screen, like this:
echo '<div><p>Post #' . $ID . ' processed</p></div>';
on a new line after the do_action, you would see if the function is being triggered correctly.
-
AuthorPosts