Need sql to remove tags from older posts

Well, think splitting the task in multiple pieces. First we need to get the post id’s which has the category with id 705 and then we’ll remove the tags from those posts. Now if we transform this idea in to SQL then the query will be- DELETE wp_term_relationships FROM wp_term_relationships INNER JOIN wp_term_taxonomy ON ( … Read more

how to output tags that has specific value in slug

Maybe you should re-consider your tag structure, if you must search for sub-strings, to be able to use it. Otherwise you can try e.g. $terms = get_terms( [ ‘taxonomy’ => ‘post_tag’, ‘search’ => ‘-en’, ] ); that performs a wildcard (*) search for *-en* within the term’s name or term’s slug. Also note the support … Read more

Query posts that have at least 3 of the tags of the current post

Try this <?php //List of tag slugs $tags = array(); $posttags = get_the_tags(); if ($posttags) { foreach($posttags as $tag) { $tags[] = $tag->term_id; } } $args = array( ‘tag__in’ => $tags //Add other arguments here ); // This query contains posts with at least one matching tag $tagged_posts = new WP_Query($args); echo ‘<ul>’; while ( … Read more

Echo tag name if post has one of the tags

Function get_tag retrieves post tag by tag ID or tag object. This tags object is not connected with your current post. Use get_the_tags to retrive tags of a current post in the loop $post_tags = get_the_tags(); if ( $post_tags ) { echo $post_tags[0]->name; } Add post id to get_the_tags function to retrieve tags of this … Read more

How to get the first tag of a post as a hyperlink?

Instead of echo $tag->name . ‘ ‘; use echo get_tag_link( $tag->term_id ); See the Codex on get_tag_link() and term_id. And encapsulate the code in a function. Put this into your functions.php: function wpse_49056_first_post_tag_link() { if ( $posttags = get_the_tags() ) { $tag = current( $posttags ); printf( ‘<a href=”https://wordpress.stackexchange.com/questions/49056/%1$s” itemprop=”url”><span itemprop=”title”>%2$s</span></a>’, get_tag_link( $tag->term_id ), esc_html( … Read more

Remove commas between tags

It’s not a php file, it’s a core function: the_tags(). <?php $before=””; $seperator=””; // blank instead of comma $after=””; the_tags( $before, $seperator, $after ); ?>

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