Turning on output buffering in a wordpress plugin

Although I realise this is probably not the right way to go about it, I managed to turn on output buffering using the following code in my plugin: add_action(‘init’, ‘rsq_buffering’); function rsq_buffering() { ob_start(); } I probably should be doing any session stuff from within the init hook instead of just all over the place.

WordPress Plugins Don’t Automatically Update

I have several installations of wordpress on my vps… You need to look in your error logs and find out if it is a permissions problem or something else. Everything will be in the logs on a VPS, unlike cheaper shared hosting. Google “error logs” for the OS of your VPS.

convert more tag to shortcode

Try adding this to your plugin file (or functions.php). You’ll use [my_more] as the shortcode for this example. function wpse50449_more_func( $atts ){ return “\n<!– more –>\n”; } add_shortcode( ‘my_more’, ‘wpse50449_more_func’ );

Default taxonomy template in plugin, override in theme

This is what I ended up using (for all those interested): function override_tax_template($template){ // is a specific custom taxonomy being shown? $taxonomy_array = array(‘tax1′,’tax2’); foreach ($taxonomy_array as $taxonomy_single) { if ( is_tax($taxonomy_single) ) { if(file_exists(trailingslashit(get_stylesheet_directory()) . ‘tax-template-directory/taxonomy-‘.$taxonomy_single.’.php’)) { $template = trailingslashit(get_stylesheet_directory()) . ‘tax-template-directory/taxonomy-‘.$taxonomy_single.’.php’; } else { $template = BASE_PLUGIN_DIR . ‘includes/tax-template-directory/taxonomy-‘.$taxonomy_single.’.php’; } break; } } … Read more

How to change the post form from plugin?

If you want to change/add something to post form, you have to deal with meta boxes. I would recommend you to read through these articles: Reusable Custom Meta Boxes Part 1: Intro and Basic Fields Reusable Custom Meta Boxes Part 2: Advanced Fields Reusable Custom Meta Boxes Part 3: Extra Fields Reusable Custom Meta Boxes … Read more

Why can’t I call a (member) function from within a foreach?

You use $mediatags variable in global scope as array in your loop, and then try to use the same variable as object in your function. You override your global $mediatags variable in your loop. Try to use following code: foreach($new_name_for_mediatags_array as $mediatag){ $args=”media_tags=animals&numberposts=10&return_type=li&size=thumbnail”; $media_items = get_attachments_by_media_tags($args); echo $media_items; };