list tags with count in author profile page

Here you go: function get_author_post_tags_wpa78489($author_id,$taxonomy = ‘post_tag’){ //get author’s posts $posts = get_posts(array( ‘author’ => $author_id, ‘posts_per_page’ => -1, ‘fields’ => ‘ids’ ) ); $ts = array(); //loop over the post and count the tags foreach ((array)$posts as $p_id) { $tags = wp_get_post_terms( $p_id, $taxonomy); foreach ((array)$tags as $tag) { if (isset($tags[$tag->term_id])){ //if its already … Read more

How to hide a plugin metabox for non admins when a user adds a new post

You can try to add this line to your code example for the admin_menu filter: remove_meta_box(‘awd_fcbk_awd_mini_form_metabox’, ‘post’, ‘side’); where awd_fcbk is the plugin slug. Edit: This is the metabox that I’m targeting from the plugin source code: //Like button manager on post page type add_meta_box($this->plugin_slug . “_awd_mini_form_metabox”, __(‘Facebook AWD Manager’, $this->ptd) . ‘ <img style=”vertical-align:middle;” … Read more

“is_new_day()” alternative for years?

You could create a helper function that returns a year number only once per year: function get_unique_year( $post_id = 0 ) { static $last = 0; $post_id || $post_id = get_the_ID(); $year = get_the_time( ‘Y’, $post_id ); if ( $year === $last ) return; $last = $year; return $last; } Then fetch your posts and … Read more

Notice: Undefined index: suppress_filters

If $query->query_vars[‘suppress_filters’] is not set you will get that message. Use empty($query->query_vars[‘suppress_filters’]) instead of false == $query->query_vars[‘suppress_filters’] ) or use $query->get(‘suppress_filters’) like this false == $query->get(‘suppress_filters’). Untested (minimally tested) but I believe either of those should give you the same results minus the notice.

Removing unneccessary p-tags (Not every p)

If what you want is really only to prevent WordPress from adding empty <p></p> and you’d be happy with removing those after post retrieval from the database, then function wpse108194_remove_empty_paragraphs( $content ) { $content = preg_replace( ‘#<p>\s*</p>#’, ”, $content ); return $content; } add_filter( ‘the_content’, ‘wpse108194_remove_empty_paragraphs’, 11 ); will do.