Same option_id=0 for 2 options in wp_options?

If we check how the wp_options table is created (in 4.4) from the schema.php file, we will find the following: CREATE TABLE $wpdb->options ( option_id bigint(20) unsigned NOT NULL auto_increment, option_name varchar(191) NOT NULL default ”, option_value longtext NOT NULL, autoload varchar(20) NOT NULL default ‘yes’, PRIMARY KEY (option_id), UNIQUE KEY option_name (option_name) ) $charset_collate; … Read more

WordPress page title repeated in SOME pages

In order to play nicely with Plugins or other code that attempts to modify the HTML document title content (i.e. wp_title() output), you should always and only output this: <title><?php wp_title( ” ); ?></title> …and if you want to modify that output yourself, filter wp_title instead of hard-coding anything inside the <title></title> tags. So for … Read more

SQL query not working in alphabetical post title/content search

Dude, no need of the SQL mess! WP allows you to search through the post content or titles alphabetically using the search parameter. So, use this solution instead… global $wpdb; $q = $_REQUEST[‘q’]; $posts = get_posts(array(‘s’ => $q, ‘post_type’ => ‘question’, ‘posts_per_page’ => -1)); echo ‘<ul>’; foreach($posts as $post){ echo ‘<li><a href=”‘.get_permalink($post->ID).'”>’.$post->post_title.'</a></li>’; } echo ‘</ul>’; … Read more

WordPress SQL LIKE request doesn’t work for fields with special symbols

What I miss here? How to search through any elements in this field? Your SQL statements, or the LIKE ‘%a%’ and LIKE ‘%full%’, are good. But the wpdb::prepare()‘s documentation says, “Literal percentage signs (%) in the query string must be written as %%“, hence you should actually use LIKE ‘%%a%%’ and LIKE ‘%%full%%’. But then … Read more

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