Usage of filters

The filter is added before the call to fetch_feed, then immediately removed so only that particular feed is given a different feed cache transient lifetime. Any other fetch_feed calls within the lifetime of the request won’t have that filter applied, so will be given whatever the default cache transient lifetime value is.

Filter Shortcodes when using get_page

If you want to display the shortcodes in the string variable $content you can use the WordPress function do_shortcode() like this: echo do_shortcode($content); See more in the Codex: http://codex.wordpress.org/Function_Reference/do_shortcode

preg_match() not working with post content

In your code, $content does not exist. You need to accept the argument into your function: function find_my_image( $content ) { if ( is_single() ) { if ( preg_match( ‘/(<img[^>]+>)/i’, $content, $result ) ) { $content .= ‘<p>Image has been found</p>’; } else { $content .= ‘<p>Sorry, no image here!</p>’; } } return $content; } … Read more

How to stop filter from running on the index.php page?

You need to return content from filter function. function find_my_image( $content ) { if( is_single() ) { if ( preg_match(‘#(<img.*?>)#’, $content, $result ) ){ $content .= ‘<p>Image has been found</p>’; } else{ $content .= ‘<p>Sorry, no image here!</p>’; } } return $content; } add_filter( ‘the_content’, ‘find_my_image’ );

WordPress overwrites UNC

You could attempt to alter the allowed protocols. function wp_allowed_protocols_unc_wpse_100080($protocols) { return $protocols + array(‘file’); } add_filter(‘kses_allowed_protocols’,’wp_allowed_protocols_unc_wpse_100080′); And add links of the form file://///path/to/file.txt— see https://stackoverflow.com/questions/1369147/linking-a-unc-network-drive-on-an-html-page I do not know if that will work. That need for five slashes could be an issue. You could also create a shortcode. function unc_link_wpse_100078($atts,$content) { return ‘<a href=”https://wordpress.stackexchange.com/questions/100080/file://///”.$content.'”>’.$content.'</a>’; … Read more

Shortcode / plugin with custom (flexible) output

The first problem you didn’t even mention is: you are putting shortcodes into a theme. Shortcodes are pure plugin territory, because they are changing post content and must survive a theme switch. Once you fixed that and moved the shortcodes to a plugin named inferno_shortcodes, the rest is easy: In your plugin ask for theme … Read more

Filter causing loss of _wp_attachment_metadata

Given that that is a filter, it should be returning $metadata instead of returning nothing. add_filter( ‘wp_generate_attachment_metadata’, ‘mvt_save_photo_credit’, 10, 2 ); function mvt_save_photo_credit( $metadata, $attachment_id ) { add_post_meta($attachment_id, ‘_mvt_credit’, $metadata[‘image_meta’][‘credit’], true); return $metadata; // <– giving back what we got } I was able to duplicate the issue you describe, and that small change fixed … Read more