Display custom list of tags in post/page editor with hooks

We can override the Ajax call to wp_ajax_get_tagcloud() and do a clean hack. <?php /* Plugin Name: Custom Admin Tag Cloud */ add_action( ‘wp_ajax_get-tagcloud’, ‘ajax_tag_cloud_wpse_99497’, 1 ); function ajax_tag_cloud_wpse_99497() { // PASTE ALL THE MODIFIED FUNCTION HERE // http://core.trac.wordpress.org/browser/tags/3.5.1/wp-admin/includes/ajax-actions.php#L639 } Restore your core files to its original state, copy the modified function inside the above … Read more

Exclude specific tags (by id) from the_tags

Not sure that this is the best decision, but you can use the filter to cut your special tag without modifying templates. add_filter(‘the_tags’, ‘wpse_320497_the_tags’); function wpse_320497_the_tags($tags) { $exclude_tag = ‘word’; // You can add your own conditions here // For example, exclude specific tag only for posts or custom taxonomy if(!is_admin() && is_singular()) { $tags … Read more

Efficient Tag Management?

I manage a blog with 3 editors and 8-10 contributors. In my experience, the best way to manage tags is to simply instruct contributors not to add tags to their own articles, and instead have the editors be responsible for tagging articles. You can then work with editors to agree on what the purpose of … Read more

Limit tag cloud terms by date

Well it’s not that it’s not possible it just means it will take some effort. I am able to use an SQL query that combines the posts, term_relationships and terms tables. This allows a tag or name to be associated with a post which was published on a particular date. This was the sql statement … Read more

Display all posts of current viewing tag

Ok .. after searching for a while I figured out what I was doing wrong. I wasn’t including custom post types in the loop. I ended up constantly with ‘not found’. Whats the solution: query_posts( array( ‘post_type’ => ‘blog’, ‘showposts’ => 3, ‘orderby’ => ‘rand’) ); if ( have_posts() ) : while ( have_posts() ) … Read more

Exclude a specific tag from the get_the_tags list

$tags = get_the_tags( $post->ID ); $separator=” “; $output=””; if($tags){ echo ‘<div class=”entry-tags”>’; echo “<p><span>” . __(‘Tags’, ‘tracks’) . “</span>”; foreach($tags as $tag) { // dpm($tag) here by uncomment you can check tag slug which you want to exclude if($tag->slug != “yourtag”){ // replace yourtag with you required tag name $output .= ‘<a href=”‘.get_tag_link( $tag->term_id ).'” … Read more

Special characters in tag get removed for comparison on save

Basically, when you add a new term, WordPress will use term_exists() to validate term before add it to database. term_exists() uses sanitize_title() which uses remove_accents() and sanitize_title_with_dashes() to sanitize term. remove_accents() will converts all accent characters to ASCII characters and sanitize_title_with_dashes() will limits the output to alphanumeric characters, underscore (_) and dash (-), whitespaces will … Read more

How to use meta data for each tag cloud a

WordPress outputs a handy class name for each tag cloud link using the format .tag-link-{term_id}. This will allow us to target each term by its id. This code will generate styles for term links output by the tag widget: add_action( ‘wp_head’, ‘wpse_tag_colors’ ); function wpse_tag_colors() { $terms = get_terms( [ ‘taxonomy’ => ‘category’, ‘hide_empty’ => … Read more

Individual css class for each tag in wp_tag_cloud

try this code: add_filter ( ‘wp_tag_cloud’, ‘tag_cloud_font_size_class’ ); function tag_cloud_font_size_class( $taglinks ) { $tags = explode(‘</a>’, $taglinks); $regex1 = “#(.*style=”font-size:)(.*)((pt|px|em|pc|%);”.*)#e”; $regex2 = “#(style=”font-size:)(.*)((pt|px|em|pc|%);”)#e”; $regex3 = “#(.*class=”)(.*)(” title.*)#e”; foreach( $tags as $tag ) { $size = preg_replace($regex1, “(”.round($2).”)”, $tag ); //get the rounded font size $tag = preg_replace($regex2, “(”)”, $tag ); //remove the inline font-size style … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)