I have been trying to achieve this for the past two days but nothing works. I am attempting to build functionality to search any post, page, and a couple other custom post-types by a tag. I have created a plugin which registers a taxonomy called search_tag. search-tags.php require_once __DIR__ . '/includes/search-tags.class.php'; function search_tags_closure() { $search_tags = new Search_Tags; $search_tags->create_taxonomy(); } add_action('init', 'search_tags_closure'); search-tags.class.php class Search_Tags { const NAME = 'search_tag'; const LABEL = 'Search Tags'; protected function get_post_types() { $args …
I used the Query Monitor plugin to find slow query on my WordPress site. The below-mentioned WP_Query->get_posts() takes about 0.3446 query time out of the total Database Query time of 0.3976. SELECT wp_posts.ID FROM wp_posts LEFT JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) WHERE 1=1 AND wp_posts.ID NOT IN (203598) AND ( wp_term_relationships.term_taxonomy_id IN (17) OR wp_term_relationships.term_taxonomy_id IN (11652,20693,21952,23971,24907,24908,25928) ) AND wp_posts.post_type = 'post' AND ((wp_posts.post_status = 'publish')) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 6 I'm guessing it …
Wordpress tinyMCE keep adding <p> tags when I saved my custom post types in visual mode opened! I had searching for many solutions, but not working. Here is the solution that I found, but this is unable to stop wordpress from adding annoying <p> tags from my html codes: Javascript: <script type="text/javascript"> tinyMCE.init({force_p_newlines : false}); </script> PHP function tinymce_remove_root_block_tag( $init ) { $init['wpautop'] = false; $init['force_p_newlines'] = false; $init['forced_root_block'] = false; return $init; } add_filter( 'tiny_mce_before_init', 'tinymce_remove_root_block_tag' ); I don't …
I have a lot of Pages which can be (need to be) grouped under a number of different Categories. ** Then the more important thing is, i need to control those pages (of different groups) programatically via functions.php. Lets say, i would have: Page A (Categorized as: Fruits) Page B (Categorized as: Vehicles) Page C (Categorized as: Vehicles) Page D (Categorized as: Fruits) Page E (Categorized as: Technology) Then from functions.php, there would be some logics, like: If Page is …
Wordpress doesn't natively search for tags so I need to install WP Extended Search and add post_tags as one of its parameters so whenever I search for keywords natively, posts with that tag will appear. However, when I tried searching on the wp-json REST API, that post doesn't appear. Here's an example with a post that is tagged with "technology". When I search "technology " using this json rest api url, it returns an empty array: example.com/posts?search=technology But if I …
I have added alt tags, title and description on all the images on my website but none are showing when I check them in the inspect element tool in chrome or firefox. Here's a screenshot: And here's the screenshot of inspect element of the same image:
i am having a wallpapers site. I was having lots of posts with no tags and i tried some plugins to auto add tags like simple tags where you need to set some tags and it will auto use those tags for posts, then i used auto tag posts option and it added all the 50-60 tags to a number of individual posts,Means it added 50-60 tags to each of the posts in 500 posts. Its very time consuming now …
My site with pictures is set up so that the posts do not have a title and have only tags. I would like to know how to use all tags in permalinks settings?
I want to add an option to my site to filter posts by one specific tag on the category page and at the same time have a nice URL (no query strings). So something like this: https://example.com/%category%/ - standard category link (currently) https://example.com/%category%/%tag%/ - a page like the above, but displaying posts from a specific category AND tag. Is this possible? If so, how can I achieve this? I would also like to note that for posts I have such …
I'm having a recipe site where every post naturally contains ingredients. Every ingredient is a tag, and I would like to automatically link every ingredient so the user can click on it and see all recipes that uses that certain ingredient. For this to be possible I guess I have to loop through every word in the post, then check if that word is equal to an existing tag, and wrap that word in a hyperlink. But I'm not sure …
I have a number of sports sites with hundreds of thousands of existing news posts. The site also has a custom post type for team and a custom post type for person. I wish to be able to somehow automatically find team names and player names in news post body and hyperlink them to the correct team / player post. The post names exist with exact player and team names. For example Lionel Messi << Player post Manchester United << …
Good afternoon. There is a shortcode [alltags] that displays ALL site tags on a separate page of the site in alphabetical order with a letter. function wph_alltags_shortcode( $atts, $content ) { $posttags = get_tags(); $output = ''; if ( $posttags ) { $output = '<dl class="alltags">'; foreach ( $posttags as $tag ) { $l = mb_strtoupper( mb_substr( $tag->name, 0, 1, 'UTF-8'), 'UTF-8' ); if ( $L != $l ) { if ( $L ) $output .= '</dd>'; $L = $l; …
Page in question. I'm trying to use a WP_Query(); targeting specific categories and displaying all the tags used for posts within those categories. I noticed that some tags, like truffles aren't being included in the results even though that post is categorized as a recipe and it's other category, sweets, is also included in the category array. Any thoughts on what I'm doing wrong so as to get only some of the tags? Thanks! <ul class="tag-list"> <?php $query = new …
I have added alt tags, title and description of all the images on my website but many do not show up when I check them in the inspect element tool in chrome or FireFox. SEMRush states over 900 images do not have alt tags! For example, the image on my homepage www.medispera.com in the code it states alt="image" instead of the alt text appearing. Please advise how to fix.
I have a category called "Featured", but I don't want this category tag to be shown at the bottom of single post pages. I do want to display the other category tags. How do I hide the tag for this one category?
I have a WooCommerce site and am working on the product tag pages. I want to display every product that is assigned to that tag, and break them up into their individual categories (this bit is working). The only issue I am having is it is displaying every single category, even if 0 products in the current tag have that assigned. <?php $tag_id = get_queried_object(); ?> <div id="product-list" class="product-list"> <?php // Get all products inside the current tag ?> <?php …
One news aggregator wants to have RSS feed without any links into the <description> field. So I try to use this code in functions.php to remove <a href></a> tags, but it doesn’t work. What’s wrong? How can I remove the tags but keep intact all the text? add_filter('the_content', 'my_custom_feed'); function my_custom_feed( $content ){ global $post; if ( ! is_feed() ) return $content; // Remove all shortcodes $content = strip_shortcodes( $post->post_content ); $content = strip_tags( $content ); // Remove all html …
I am trying to output all the tags (custom taxonomy) without link, and add special class to current post tags. For example: if there are 10 tags but current post has 3 of them applied, then it should display all the 10 tags without link but only 3 tags should have special class. I am currently using: $terms = get_the_terms( $post->ID, $tax ); $tag_list = implode(',', wp_list_pluck($terms, 'term_id') ); wp_tag_cloud( array( 'taxonomy' => $tax, 'include' => $tag_list) ); which is …
I'm trying to use the "Embed URL" block to include another WP site's tag page on my WP page. It seems like I'm able to embed individual posts from that site (so the theme supports embedding) but I get the error "Sorry, this content could not be embedded." when I try to use the tag page url. Is it possible to embed a tag page?