• Resolved ronr1999

    (@ronr1999)


    One problem with doing a bulk upload of products into WooCommerce, it creates essentially all the products with the same date time stamp. Will your plugin work on products (or custom post types)?

    Thanks! Ron.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter ronr1999

    (@ronr1999)

    No worries… I was able to convert it to work on Products.

    In file index.php:

    $params = array(
    ‘post_type’ => ‘product’, <————– add this

    Change to post_date from post_modified
    “UPDATE $wpdb->posts SET post_date=’%s’, post_modified_gmt=’%s’ WHERE ID = %d”,

    Hi @ronr1999

    I was about to customize the code for this exact same purpouse, when I stumbled upon this support thread. It would be great if you could explain a little bit better why you changed the query to update WordPress database the way you did.

    I don’t know much about WordPress, but looking at the wp_post SQL table in WordPress database, it seems that for each entry in this table (be it post, product or any other custom taxonomy), there are 4 dates:

    > post_date
    > post_date_gmt
    > post_modified
    > post_modified_gmt

    You showed in your message that you changed “post_modified” to “post_date” in order for the plugin to work on Woocommerce products. But wouldn’t it make more sense to update all 4 dates at the same time?

    Also, why change the “post_date”? Isn’t it the original publishing date of the post (in this case, product)? Since we are updating existing posts isn’t it more “natural” to let publish date “as is” and update only post_modified and post_modified_gmt dates, as per original plugin code?

    Thank you in advance for any additional info!

    Plugin Author Atiq Samtia

    (@atiqsamtia)

    Hi @guilhermefr

    As per @ronr1999 ‘s use case, he imported all products and want to change the original dates first time only. It makes sense for updating post_date [published date].

    I’ll add Woocommerce support into the plugin in the next update maybe over the weekend.

    @ronr1999 ‘s solution is good. But for the general public, we need a new Tab in UI with a categories list to choose from. If someone wants to contribute you can send a pull request to GitHub repo and I’ll merge and push the update.

    Repo Link github

    Thread Starter ronr1999

    (@ronr1999)

    Hi guilhermefr,

    I found when using Elementor’s Post Navigation that it uses the post_date and the navigation was confused when, in my case, all the post_dates were the same. Again, all the same because I did a bulk upload of products.

    Ron

    @ronr1999 Thank you for your reply!

    @atiqsamtia I posted my initial reply because I was thinking about using your plugin for SEO optimization purposes. And it seems that other popular plugins (like Republish Old Posts and WP Auto Republish) change post_date(_gmt) as well as post_modified(_gmt) entries, while yours changes only post_modified. I still don’t know what is the best solution (still researching).

    Your solution of adding an additional tab is certainly a good one, since the other plugins cited do not offer this feature for free. Maybe an improvement of this idea would be to allow the user to select the custom post type to which the date updates should be applied (WooCommerce is only one popular custom post type – there are many others).

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Will this work on Woocommerce Products?’ is closed to new replies.