How to exit a plugin’s execution mid-stream?

A possible solution would be to hook in way late (template redirect, for example), do your conditional check. If it passes, include (or require) a file that contains the stuff needed. <?php add_action( ‘template_redirect’, ‘wpse30291_template_redirect’ ); function wpse30291_template_redirect() { if( ! is_singular() ) return; require_once( ‘your-file.php’ ); } This is not going to work if … Read more

What to hook into to check a value before a post is published?

Try function wpse46583_save($post_id,$post) { // verify this is not an auto save routine. if ( defined(‘DOING_AUTOSAVE’) && DOING_AUTOSAVE ) return; //You should check nonces and permissions here if ( !current_user_can( ‘edit_page’, $post_id ) return; //Get category slugs associated with post $cats =get_the_category($post_id); if(empty($cats)){ //No category assigned – do something here. } return; } add_action(‘save_post’,’wpse46583_save’,10,2);

wordpress JSONAPI introspector always limits number at 10?

I’m answering my own question because it might be useful to someone else sometime. After reading through the somewhat sparse documentation on the wordpress plugin directory and getting nowhere. I found a variable in the JSON API code here’s how it works PS -1 just mean “all”: $json_api->query->count=-1; $posts = $json_api->introspector->get_posts(array(‘post_type’ => array(‘post’,’tweet’,’gallery’,’video’,’music’), ‘post_parent’ => … Read more