Help!! I Screwed up my WP

since i posted as a comment and most people miss the good tips that are in the comments, I’m posting again as an answer The reason is because GD Star rating plugin creates custom capabilities and your query deleted all references of %rating% it deleted the wp_user_roles option which holds all capabilities roles. the solution … Read more

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

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

Show only one post for each author ( Page loads too slow )

Edit: I just tested and it works perfectly. You’ll also want to remove pagination from the author template. I haven’t tested it, but have you tried pre_get_posts? function author_filter($query) { if ( !is_admin() && $query->is_main_query() ) { if ($query->is_author()) { $query->set( ‘posts_per_page’, 1 ); } } } add_action(‘pre_get_posts’,’author_filter’);

MySQL query performed 4 times inside loop

Using a plugin to run PHP code inside your content is not the sanest thing to do, especially when said code is not idempotent. Basically, you cannot guarantee that your code will only run once per page load, since several different things in the system may be processing your content, and thus executing your code, … Read more