• Hi,

    My product short descriptions are wrote in “h6”. Now I want to change all those to “paragraph”. Is there any easy way to do it? I have around 200 products.

Viewing 3 replies - 1 through 3 (of 3 total)
  • However you decide to do this, make sure you back up your posts table first!

    If you have access to phpMyAdmin you could do it directly in the database by running the two queries below on your posts table (change the table name to fit your installation’s use of a prefix, if any). To change the opening “<h6>” tag:

    
    UPDATE wp_posts SET post_excerpt = REPLACE(post_excerpt, '<h6>', '<p>') WHERE INSTR(post_type, 'product') > 0
    

    Then, for the closing “</h6>” tags:

    
    UPDATE wp_posts SET post_excerpt = REPLACE(post_excerpt, '</h6>', '</p>') WHERE INSTR(post_type, 'product') > 0
    

    I haven’t tested those queries, thus the importance of backing up your posts table. You’d have to try them, clear any caching plugin you’re using, and then check the site to see if it worked, restoring the table from backup if it breaks anything.

    The other option would be to use a plugin like Better Search Replace to do the substitution.

    Thread Starter mayasl

    (@mayasl)

    I installed the plugin. Dry run found there are 240 changes, whereas I have only 210 products. So, I doubt it is going to change something else those are not products. Due to the limitation in the free version, I am unable to manually check the results. So, will buy the pro version and update the result here.

    Thank you mate!

    It could be that the plugin is changing it in both the post_content and the post_excerpt fields of the posts table, accounting for the difference in numbers. If you’re using H6 in a post, or in a product description, it would be changing those too.

    If it were me, I’d back up the posts table and try the two queries I gave you, because I limited those to the post_excerpt (product short description) and to just products.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Change product short description in bulk’ is closed to new replies.