Search for tags olatechproFebruary 22, 20232 Views Is it possible, to search just for tags? Not any other taxonomies or post types, just tag titles. Post Views: 2 Related postsGet rid of this Strict Standards warningWooCommerce: get_current_screen not working with multi languageCan’t login on WordPressForce HTTPS using .htaccess – stuck in redirect loopWordPress: Ajax not working to insert, query and result dataHow Can I pass an image file to wp_handle_upload?
Yes its very possible, you just need to create your own search form and processing function form: <form name="tag-search" method="POST" action=""> <input type="text" vlaue="" name="tag-q" id="tag-q"> <input type="submit" name="tag-submit" id="tag-submit" value="Search Tags"> </form> processing: <?php if (isset($_POST['tag-submit']) && $_POST['tag-submit'] == "Search Tags" && isset($_POST['tag-q']) && $_POST['tag-q'] != ""){ // @todo Sanity check and cleanup $_POST['tag-q'] here. $args = array('name__like' => $_POST['tag-q']); $tags = get_tags($args); $html = '<div class="post_tags_search_r">'; foreach ($tags as $tag){ $tag_link = get_tag_link($tag->term_id); $html .= "<a href='{$tag_link}' title='{$tag->name} Tag' class='{$tag->slug}'>"; $html .= "{$tag->name}</a>"; } $html .= '</div>'; echo $html; } ?> No this is something i have used in the past, the only downside to this is that name__like is case-insensitive so you might want to add the strtolower version to the name__like. Log in to Reply
Yes its very possible, you just need to create your own search form and processing function
form:
processing:
No this is something i have used in the past, the only downside to this is that
name__like
is case-insensitive so you might want to add the strtolower version to the name__like.