Huge wp_options table

I’d be interested to validate what you’re looking at there to make sure it really is that table. MySQL shouldn’t behave like this unless you actually have 12Gb in a row somewhere. But if you can run SQL on this database, maybe you want to try MySQL OPTIMIZE TABLE command which asks MySQL to see … Read more

Problems migrating WordPress to localhost

First of all what I assume is your local server is not parsing the php properly. So just put a simple phpinfo file and see if that show you the expected page. You can take reference from the following link if you don’t know how to create a phpinfo page – https://mediatemple.net/community/products/dv/204643880/how-can-i-create-a-phpinfo.php-page If the above … Read more

Too many pages causes WordPress admin to be unusable

Unfortunately the details you’ve provided are a bit limited. For example, what sort of hosting are you on and what sort traffic are you dealing with here? If you have a shared hosting account then you should know that shared hosts provide you with limited cpu and memory resources as it’s shared across multiple hosting … Read more

wpdb prepare syntax

Just look at the generated string: INSERT INTO ‘wp_table’ (id, datea, one, two) VALUES (1, ‘2013-12-24’, 3, ‘NULL’) ON DUPLICATE KEY UPDATE one = VALUES(one), two = VALUES(two); The problem is the quotes around the table name. (Your hand-written query has no quotes around the table name, and works.) prepare is intended for dynamic user … Read more

Using Echo in ShortCode – Stuck

You can also use output buffering to catch all output you generate. Use it like following: function fl_aries_co_today_shortcode() { global $wpdb; $results = $wpdb->get_results(“SELECT horoscope FROM wpaa_scope_co WHERE date = CURDATE() AND sign = ‘aries'”); ob_start(); foreach($results as $r) { echo “”.$r->horoscope.””; } $content = ob_get_contents(); ob_end_clean(); return $content; } add_shortcode( ‘fl_aries_co_today’,’fl_aries_co_today_shortcode’ );

Custom Query to search through categories

It sounds like you’re looking for the get_terms() function that’s a wrapper for WP_Term_Query. There you can e.g. use the name__like, description__like or search parameters. Example: Here’s what kind of WHERE query they generate: ‘name__like’ => ‘hout’ >>> (t.name LIKE ‘%hout%’) ‘description__like’ => ‘hout’ >>> tt.description LIKE ‘%hout%’ ‘search’ => ‘hout’ >>> (t.name LIKE ‘%hout%’) … Read more

Add value to usermeta without removing previous values?

update_user_meta( int $user_id, string $meta_key, mixed $meta_value, mixed $prev_value=”” ) updates existing user meta based on user_id and meta key. If there are many fields with the same key, you can pass `prev_value’ to tell which field you want to update. add_user_meta( int $user_id, string $meta_key, mixed $meta_value, bool $unique = false ) adds meta … Read more