WordPress Search return wrong results

The reason for this is that WordPress searches for matches using LIKE %post%, meaning that any post (that is Post, Page or custom post type object) that contains post in it’s title or content is found. You can alter this default behaviour by using the posts_where action hook. add_action( ‘posts_where’, ‘my_alter_search_where’ ); function my_alter_search_where( $where … Read more

Plugin loaded, but not running

After some extended debugging we found the issue. The plugin uses Google’s url shortener api, which uses an api key for any kind of large volume. Our dev instance (more accurately the public ip assoiated with it) was under the threshold for not needing a key. Production was over but there wasn’t adequate error handling … Read more

Create Array from data in the OPTIONS table

$all_options = wp_load_alloptions(); $plugin_order_options = array(); foreach( $all_options as $name => $value ) { if(stristr($name, ‘plugin_order_’)) $plugin_order_options[$name] = $value; } print_r($plugin_order_options); In plain English: We load all WP options in $all_options. We copy options from $all_options to $plugin_order_options if their name contains plugin_order_. We print $plugin_order_options. We scratch our head, unhappy with the size of … Read more

Content-single.php inside my plugin

In case anyone will want to do this, this is what worked for me: In my single-my_custom_post_type.php I replaced this line: get_template_part(‘content’, get_post_format()); With this one: include ‘content-spp_service_provider.php’;