Using the same shortcode to show any table from the database
Using the same shortcode to show any table from the database
Using the same shortcode to show any table from the database
The best approach would be: Get an array of all of the post IDs in the database. Get an array of all of the post IDs that the user has rated (as you have done in your example) Remove the IDs in step 2 from step 1 – you’ll then have an array of all … Read more
Proper way to trigger a MySQL query via link in a plugin
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
There is way to improve this query? wordpress get post data and some meta data
I’m not sure why you are using the the_date() function, but if you must, make sure it returns the value instead of echo-ing it. So instead of this part: array( ‘value’ => the_date(‘Y-m-d’) ), try this one: array( ‘value’ => the_date( ‘Y-m-d’, $before=””, $after=””, $echo = 0 ); ), To catch the update error, check … Read more
Query Distinct Taxonomies of Custom Post Type
I managed to solve this by taking s_ha_dum’s suggestion to use a UNION. It is as follows: (SELECT ID, post_status, post_title, post_excerpt, post_content FROM wp_posts WHERE ((`post_title` LIKE ‘%diamond%’) OR (`post_excerpt` LIKE ‘%diamond%’) OR (`post_content` LIKE ‘%diamond%’)) AND (`post_status` = ‘publish’ )) UNION (SELECT ref, StoreID, Article, subarticle, description FROM wp_hwproducts WHERE (`article` LIKE ‘%diamond%’) … Read more
If you take a look at get_terms() documentation it accepts search argument, which will perform LIKE match against term name and slug.
My blog has over 700,000 articles… You need to look at your webhost and server. WordPress is perfectly scalable, but you need the hardware to back it up. That’s a database intensive query, and you need the MySQL server to handle it. Run mysqltuner.pl https://github.com/major/MySQLTuner-perl to check your MySQL configurations and adjust cache and memory … Read more