Running a PHP SQL script on a wordpress page

Your problem involves a technique called REST API. WordPress supports it. All you need is to make a plugin → register_rest_field → pass your data through it. What you want to do may seems simple but it is still lot of works. Also, remember to tighten plugin security.

A query to substitute images paths in gutenberg (website migration)?

I just found out the reason. It’s because I’m using ACF Pro as Blocks. The data will be written in database in json format, and the urls will escape all the slashes ad double quotes. So for example src=\”http:\/\/dev.example.com\/website\/wp-content\/uploads\/2019\/10\/identity.jpg\” So I should add a row like this: update wp_posts set post_content = replace(post_content,’http:\/\/dev.example.com\/website’, ‘http:\/\/www.website.com’);

Woocommerce change the price of products in the database

So after a few attempts, I managed to change the price for variable products. If someone needs to send my code: UPDATE wp_postmeta LEFT JOIN wp_posts ON wp_posts.id = wp_postmeta.post_id LEFT JOIN wp_term_relationships ON wp_posts.post_parent = wp_term_relationships.object_id SET wp_postmeta.meta_value = wp_postmeta.meta_value*1.05 WHERE wp_posts.post_type=”product_variation” AND wp_postmeta.meta_key = ‘_regular_price’ AND wp_term_relationships.term_taxonomy_id = ‘2396’

How to get products without tag?

I’m going to answer my own question: SELECT ID FROM wpyw_posts WHERE ID NOT IN ( SELECT wpyw_term_relationships.object_id FROM wpyw_term_relationships INNER JOIN wpyw_term_taxonomy ON wpyw_term_taxonomy.term_id = wpyw_term_relationships.term_taxonomy_id WHERE wpyw_term_taxonomy.taxonomy = ‘product_tag’ ) AND wpyw_posts.post_type=”product”

SQL query to change custom field in WordPress database

Recommend a database backup before you do this. ** updated the statement to specify “Y”, empty string, or null ** global $wpdb; $wpdb->query( “update {$wpdb->postmeta} SET meta_value=”X” WHERE meta_key = ‘old_price’ AND ( meta_value=”Y” OR meta_value=”” OR meta_value IS NULL ) );” );

I want to run Sql Query in script how can i do this

You can use ES6 Promise inside for-each function. So that the loop stop, wait for response from ajax call, than continue loop again with response data. Promises are a clean way to implement async programming in JavaScript (ES6 new feature). Prior to promises, Callbacks were used to implement async programming. Let’s begin by understanding what … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)