optimise SQL wordpress call

The query itself may need to be optimized (SQL is not my speciality, though). However, don’t forget you can store the results of an expensive operation in cached memory. WordPress offers a Transients API to make things easy. Here’s a quick example: // Try to load the value from cache $transient_key = ‘my_query’; $value = … Read more

looking for a way to allow users to backup the plugin db data(save as)

WP has Filesystem API to write files. However it can be relatively convoluted to implement (since it handles fallback for many cases and environments and workflow for requesting FTP crednetials from users) so often simply PHP functions are used to write file. Works reliably when constrained to uploads folder, otherwise need to be sure about … Read more

How to add chunk of php, html, and sql code to variable an append to $content

You appear to be quite close to having this all sorted out. If you wrap your queries in a function, and separate the logic and presentation: <?php function wpse_158425_get_terms(){ global $wpdb, $rpt_options; $wpdb->show_errors(); $rpt_days = $rpt_options[‘number_days’]; $rpt_term_ids = $wpdb->get_col(” SELECT term_id FROM $wpdb->term_taxonomy INNER JOIN $wpdb->term_relationships ON $wpdb->term_taxonomy.term_taxonomy_id = $wpdb->term_relationships.term_taxonomy_id INNER JOIN $wpdb->posts ON $wpdb->posts.ID … Read more

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