custom gallery filter with image caption as link title?

I found a working solution on the WordPress Forums. Here’s the code: function add_img_title_to_anchor($content) { /* Find internal links */ //Check the page for linked images $search=”/<a ([^>]*?)><img ([^>]*?)\/><\/a>/i”; preg_match_all( $search, $content, $matches, PREG_SET_ORDER); //Check which attachment is referenced foreach ($matches as $val) { // Only if the Link doesn’t already have a Title attribute, … Read more

How To Get Search Term and Use in Function

You’re adding a filter to get_search_query, and within that function calling get_search_query, which runs your filter, which calls get_search_query, which runs your filter, which calls get_search_query, which runs your filter… do you see the problem here? The search query is passed to the filter as an argument, so you don’t need to fetch it- function … Read more

Remove pretty photo style and script if not exist!

I got it to working finally .. The code is: add_action( ‘wp_enqueue_scripts’, ‘pretty_photo_styles’, 100 ); function pretty_photo_styles() { if ( ! is_single() ) { wp_dequeue_script( ‘pretty_photo’ ); wp_dequeue_style( ‘pretty_photo’ ); } } Please someone correct it if I missed anything! I tried it and it worked for me.

Register users by e-mail

This is a required field (http://codex.wordpress.org/Function_Reference/wp_create_user) and I think that more than one function in the core of WordPress relies on that. So I would not recommend to code around it or alter any other WP core files as the next update could render all these changes back to the default values.

Access post ID in “content_save_pre”

After asking around and looking for alternatives, I came up with a working solution that works in the web frontend and in the Android/iOS XML-RPC based apps. This is the filter. add_filter(‘wp_insert_post_data’, array($this, ‘save_content2’), 9, 2); I am pretty sure it is called before the content_save_pre filter. It allows direct access to the post fields … Read more