admin管理员组

文章数量:1290978

How can I "update" a page in WordPress using MySQL? I.e., effectively click the "update" button in the page editor using MySQL? But not make any changes to the page?

What I'm doing: I'm making some bulk changes in wp_postmeta using a MySQL query in PHPMyAdmin, i.e. Woocommerce product data. I've discovered that each page needs to be manually "Updated" in the page editor for the product data to appear correctly on the front end. Once I make the changes in wp_postmeta, and then wp_update_post resave each page, the data appears correctly.

How can I resave or "Update" a number of pages, by each post_id, via MySQL so I don't ave to manually save each page? Would I use wp_update_post ? /

I don't need to use Ajax; this concerns ~100 pages and the server is fast, so an SQL query won't timeout.

How can I "update" a page in WordPress using MySQL? I.e., effectively click the "update" button in the page editor using MySQL? But not make any changes to the page?

What I'm doing: I'm making some bulk changes in wp_postmeta using a MySQL query in PHPMyAdmin, i.e. Woocommerce product data. I've discovered that each page needs to be manually "Updated" in the page editor for the product data to appear correctly on the front end. Once I make the changes in wp_postmeta, and then wp_update_post resave each page, the data appears correctly.

How can I resave or "Update" a number of pages, by each post_id, via MySQL so I don't ave to manually save each page? Would I use wp_update_post ? https://developer.wordpress/reference/functions/wp_update_post/

I don't need to use Ajax; this concerns ~100 pages and the server is fast, so an SQL query won't timeout.

Share Improve this question asked Jun 16, 2021 at 17:10 BlueDogRanchBlueDogRanch 1705 silver badges25 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

wp_update_post() is a PHP function, and you can’t trigger a page update with MySQL. You need to at least use PHP, but it’s possible that some plugins actually require manually pressing update.

For WordPress and WooCommerce content your best bet would be to use the REST API or WP CLI from the command line.

本文标签: Is it possible to quotUpdatequot pages via SQL