How do I improve this admin query snippet to avoid generating duplicate results on non-meta searches?

A GROUP BY statement can group your posts after the JOIN. For WordPress you can use the posts_groupby filter. add_filter( ‘posts_groupby’, ‘my_post_limits’ ); function my_post_limits($groupby) { global $pagenow, $wpdb; if ( is_admin() && $pagenow == ‘edit.php’ && $_GET[‘post_type’]==’listings’ && $_GET[‘s’] != ” ) { $groupby = “$wpdb->posts.ID”; } return $groupby; }

WP_Query leaking absurd amounts of memory

Excellent responses on WP Hackers: http://lists.automattic.com/pipermail/wp-hackers/2012-June/043213.html What you’re doing with that query, is loading EVERY matching post into memory, including the full post contents. As you can imagine, this is probably quite a lot of items. You can pass ‘fields’ => ‘ids’ into WP_Query to simply return a list of matching post_ids instead, which should … Read more

Custom media upload content for inserting custom post shortcode

Have a look at my guide here – http://www.wpexplorer.com/wordpress-tinymce-tweaks/ – so you can see how to create a popup window where you can select your options than insert a shortcode. If you download my Free Symple Shortcodes plugin you can see a live implementation as well. Instead of having the user select the posts to … Read more

Is it necessary to bump a plug-in’s version if you’re just updating the “Tested up to” attribute?

I would only increase the version number if users needed to download the plugin again. The “Tested up to” variable is not used when the plugin is installed, only when people want to install it or want to upgrade. In that case, the information comes from the server anyway, so you don’t need to force … Read more

No Error Log File, no debug info

Insert this into your wp-config.php // Enable WP_DEBUG mode define(‘WP_DEBUG’, true); // Enable Debug logging to the /wp-content/debug.log file define(‘WP_DEBUG_LOG’, true); // Disable display of errors and warnings define(‘WP_DEBUG_DISPLAY’, false); @ini_set(‘display_errors’,0); Before /* That’s all, stop editing! Happy blogging. */

What is difference between get_bloginfo(‘url’) and get_site_url()?

get_bloginfo(‘url’) calls home_url() calls get_home_url() reads option home get_bloginfo(‘wpurl’) calls site_url() calls get_site_url() reads option siteurl get_bloginfo(‘siteurl’) and get_bloginfo(‘home’) are deprecated arguments and return get_bloginfo(‘url’) (siteurl argument is documented wrong in Codex as equal to wpurl, it’s not in current code) The difference is that these two function chain to different options, which are typically … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)