Load WordPress core but with specific plugins

This seems to be the way: add_filter( ‘option_active_plugins’, ‘disable_plugins’ ); function disable_plugins($plugins){ return []; // you can define specific plugins you want to load here. }

Don’t update modified post date when user add a product review or comment?

WooCommerce seems to update the ‘last modified’ value of a product on every change. If you want to take a look at the source code, go to woocommerce\includes\data-stores\class-wc-product-data-store-cpt.php and check the function update. This solution seems to work, however it could be improved to make sure it doesn’t mess up with anything else. Basically checks … Read more

How to optimize and reduce excessive database queries

You can use a combination of caching plugin and appropriately coded themes and plugins to cache query results and speed things up. Yes, eventually if you are running many queries, a site can get bogged down. This typically happens when query-intensive themes or plugins are used. To start investigating your own site’s queries, there are … Read more

How To Get HTML Eelement From Another Page

You’re talking about scraping, which is generally an unreliable method of getting data, especially if you don’t control the other page. However, in PHP, once you retrieve the download page with something like wp_remote_get, you can use a regular expression to extract the pieces you need with preg_match_all. $response = wp_remote_get( ‘domain.com/download-page/’ ); $page = … Read more

Passing Current User ID into SQL statement

No need to use []… just use simple single quotations (also no quotations does the job): $sql =” SELECT … WHERE wp_users.`ID` = ‘$userID'”; OR $sql =” SELECT … WHERE wp_users.`ID` = $userID”;