how can I use WP_Query to exclude a specific tag.?

Use tag__not_in parameter. You have to use tag ID for this parameter $args = array( ‘category_name’ => $cat_name, ‘tag’ => $tag_name, ‘post__not_in’ => $sticky, ‘tag__not_in’ => array($tag_id_1, $tag_id_2) ); $my_query = new WP_Query( $args );

Display tags in list without link

This would do it… <?php $posttags = get_the_tags(); if ($posttags) { echo ‘<ul>’; foreach($posttags as $tag) { echo ‘<li>’ .$tag->name. ‘</li>’; } echo ‘</ul>’; } ?>

How can I let my audience tag my posts?

Andrew, Matt Mullenweg uses a similar feature on on his blog, Ma.tt, that lets users tag photos. He released the code as a plugin, Matts Community Tags. You will have to create a custom taxonomy for the tags and add some additional code to your templates to make it work. See the discussion on the … Read more

Stop WordPress From Removing HTML Comments In Content

This is due to a very old WordPress HTML Comment bug, that was never fully fixed. You may use Gutenberg, it handles HTML comments better. Also, This Post suggests that placing a beginning HTML comment TAG, just before the ending HTML comment tag works. Like this: <!– some HTML Comment <!– –> This is valid … Read more

What is the difference between terms and tags?

Simple yet tough question, taxonomies are just groups of categories, while terms are just single categories within these groups.* So, for example, if you create a new post and choose category for it – the category itself is a term, and opening YourWordpressURL/wp-admin/edit-tags.php?taxonomy=category you’re going to see all the categories (taxonomy). Terms and Tags are … Read more

Do tags have dates?

Following @PieterGoosen’s (credit due) train of thought hook onto the following: function update_term_timestamps($term_id) { switch( current_filter() ) { case ‘created_term’: update_term_meta($term_id, ‘_term_created_at’, current_time(‘mysql’, true)); break; case ‘edited_term’: update_term_meta($term_id, ‘_term_edited_at’, current_time(‘mysql’, true)); break; } } add_action(‘created_term’, ‘update_term_timestamps’); add_action(‘edited_term’, ‘update_term_timestamps’); Now the meta data is accessible with: //for created timestamp… $timestamp = get_term_meta($term_id, ‘_term_created_at’, true); //for edited … Read more

Check if current page has given tag ID

All the tags is inside the query, it is possible to check for this via get_query_var(); all objects inside the query. For the tag ID ask with this code: get_query_var( ‘tag_ID’ ); Also it is possible to check for tags, like get_query_var( ‘term’ ) and the taxonomy get_query_var( ‘taxonomy’ ) So you can create an … Read more

Display list of most used tags in the last 30 days

The problem was that the SQL query code was getting the term_taxonomy_id, not the actual tag ID. I added an additional INNER JOIN using the term_taxonomy table to get the term_id. This seems to work, but if a mod can improve this, please do! <ul id=”footer-tags”> <?php $wpdb->show_errors(); ?> <?php global $wpdb; $term_ids = $wpdb->get_col(” … Read more