Relevanssi prevents keyword output
-
Relevanssi prevents keyword output. I will get “Nothing Found”. If I disable the Relevanssi plugin, the keyword output works fine. What can I do? Where is the bug. The theme I use is called Enfold.
- This topic was modified 7 years, 6 months ago by Hesi.
-
What do you mean by “keyword output”?
Hallo Mikko,
I mean the Tag output of WordPress, it doesn`t work with Relevanssi. You can give a post a tag, so the tag was displayed under or over the single post like a kategory, if I click this tag, wordpress doesen’t find the posts with this tag and I get the massage “Nothing Found”.Here is an example: I will aktivate Relevanssi, so you see what happens.
https://www.as-consulting-nord.de/en/tag/scenario-planning/I can’t produce this on my test site using Twenty Fifteen. Can you try switching to one of the default themes for a moment to see if the problem persists? It may be an issue with your theme.
Are you running the latest version of Relevanssi? Can you show me the tag archive template from your theme?
I switched the theme to Twenty-Fifteen and there was no problem. So, I think the bug is in the Enfold-Theme, can I send you the Theme so you can better find out which template you need?
It’s tag.php. See this: https://www.kriesi.at/support/topic/post-tags-not-working-if-relevanssi-is-enabled/
(In general if you have a Premium theme and problems with it, the theme support is often the best place to go to.)
- This reply was modified 7 years, 6 months ago by Mikko Saari.
Ok, before I take your support I have told to the Enfold-Support about this problem. They told me to check all PlugIns. Maybe you’ll find the error. I will contact Enfold-Support again and tell them our results.
Here the tag.php
<?php if ( !defined('ABSPATH') ){ die(); } global $avia_config, $more; /* * get_header is a basic wordpress function, used to retrieve the header.php file in your theme directory. */ get_header(); echo avia_title(array('title' => avia_which_archive())); do_action( 'ava_after_main_title' ); ?> <div class='container_wrap container_wrap_first main_color <?php avia_layout_class( 'main' ); ?>'> <div class='container template-blog '> <main class='content <?php avia_layout_class( 'content' ); ?> units' <?php avia_markup_helper(array('context' => 'content'));?>> <div class="category-term-description"> <?php echo term_description(); ?> </div> <?php global $wp_query, $posts; $backup_query = $wp_query; $sorted = array('post'=>array()); $post_type_obj = array(); foreach($posts as $post) { $sorted[$post->post_type][] = $post; if(empty($post_type_obj[$post->post_type])) { $post_type_obj[$post->post_type] = get_post_type_object($post->post_type); } } $avia_config['blog_style'] = apply_filters('avf_blog_style', avia_get_option('blog_style','multi-big'), 'tag'); if($avia_config['blog_style'] == 'blog-grid') { $output = ''; $post_ids = array(); foreach($posts as $post) $post_ids[] = $post->ID; if(!empty($post_ids)) { echo "<div class='entry-content-wrapper'>"; foreach($sorted as $key => $post_type) { if(empty($post_type)) continue; if(isset($post_type_obj[$key]->labels->name)) { $label = apply_filters('avf_tag_label_names', $post_type_obj[$key]->labels->name); $output .= "<h3 class='post-title tag-page-post-type-title'>".$label."</h3>"; } else { $output .= "<hr />"; } $atts = array( 'type' => 'grid', 'items' => get_option('posts_per_page'), 'columns' => 3, 'class' => 'avia-builder-el-no-sibling', 'paginate' => 'yes', 'use_main_query_pagination' => 'yes', 'custom_query' => array( 'post__in'=>$post_ids, 'post_type'=> $key ) ); $blog = new avia_post_slider($atts); $blog->query_entries(); $output .= $blog->html(); } echo $output; echo '</div>'; } else { get_template_part( 'includes/loop', 'index' ); } } else { foreach($sorted as $key => $post_type) { if(empty($post_type)) continue; if(isset($post_type_obj[$key]->labels->name)) { $label = apply_filters('avf_tag_label_names', $post_type_obj[$key]->labels->name); echo "<h3 class='post-title tag-page-post-type-title'>".$label."</h3>"; } else { echo "<hr />"; } if($key == 'portfolio') { $args = array_merge( $wp_query->query_vars, array( 'post_type' => $key ) ); query_posts( $args ); $grid = new avia_post_grid(array( 'linking' => '', 'columns' => '3', 'contents' => 'title', 'sort' => 'no', 'paginate' => 'yes', 'set_breadcrumb' => false, )); $grid->use_global_query(); echo $grid->html(); } else { $args = array_merge( $wp_query->query_vars, array( 'post_type' => $key ) ); query_posts( $args ); $more = 0; get_template_part( 'includes/loop', 'index' ); } $wp_query = $backup_query; } } ?> <!--end content--> </main> <?php //get the sidebar $avia_config['currently_viewing'] = 'blog'; get_sidebar(); ?> </div><!--end container--> </div><!-- close default .container_wrap element -->
What happens if you add this code to the theme functions.php and visit the tag page:
add_filter('relevanssi_prevent_default_request', 'rlv_test', 10, 2); function rlv_test($prevent, $query) { var_dump($prevent); var_dump($query); return false; }
What does it print out?
Hallo Mikko, I put the snippet in the funktion.php and I get
this:
Go to:https://www.as-consulting-nord.de/en/tag/scenario-planning/Posts bool(true) object(WP_Query)#1734 (47) { ["query"]=> array(65) { ["tag"]=> string(17) "scenario-planning" ["error"]=> string(0) "" ["m"]=> string(0) "" ["p"]=> int(0) ["post_parent"]=> string(0) "" ["subpost"]=> string(0) "" ["subpost_id"]=> string(0) "" ["attachment"]=> string(0) "" ["attachment_id"]=> int(0) ["name"]=> string(0) "" ["static"]=> string(0) "" ["pagename"]=> string(0) "" ["page_id"]=> int(0) ["second"]=> string(0) "" ["minute"]=> string(0) "" ["hour"]=> string(0) "" ["day"]=> int(0) ["monthnum"]=> int(0) ["year"]=> int(0) ["w"]=> int(0) ["category_name"]=> string(0) "" ["cat"]=> string(0) "" ["tag_id"]=> int(23) ["author"]=> string(0) "" ["author_name"]=> string(0) "" ["feed"]=> string(0) "" ["tb"]=> string(0) "" ["paged"]=> int(0) ["meta_key"]=> string(0) "" ["meta_value"]=> string(0) "" ["preview"]=> string(0) "" ["s"]=> string(0) "" ["sentence"]=> string(0) "" ["title"]=> string(0) "" ["fields"]=> string(0) "" ["menu_order"]=> string(0) "" ["embed"]=> string(0) "" ["category__in"]=> array(0) { } ["category__not_in"]=> array(0) { } ["category__and"]=> array(0) { } ["post__in"]=> array(0) { } ["post__not_in"]=> array(0) { } ["post_name__in"]=> array(0) { } ["tag__in"]=> array(0) { } ["tag__not_in"]=> array(0) { } ["tag__and"]=> array(0) { } ["tag_slug__in"]=> array(1) { [0]=> string(17) "scenario-planning" } ["tag_slug__and"]=> array(0) { } ["post_parent__in"]=> array(0) { } ["post_parent__not_in"]=> array(0) { } ["author__in"]=> array(0) { } ["author__not_in"]=> array(0) { } ["meta_query"]=> array(0) { } ["post_type"]=> string(4) "post" ["ignore_sticky_posts"]=> bool(false) ["suppress_filters"]=> bool(false) ["cache_results"]=> bool(true) ["update_post_term_cache"]=> bool(true) ["lazy_load_term_meta"]=> bool(true) ["update_post_meta_cache"]=> bool(true) ["posts_per_page"]=> int(10) ["nopaging"]=> bool(false) ["comments_per_page"]=> string(2) "50" ["no_found_rows"]=> bool(false) ["order"]=> string(4) "DESC" } ["query_vars"]=> &array(65) { ["tag"]=> string(17) "scenario-planning" ["error"]=> string(0) "" ["m"]=> string(0) "" ["p"]=> int(0) ["post_parent"]=> string(0) "" ["subpost"]=> string(0) "" ["subpost_id"]=> string(0) "" ["attachment"]=> string(0) "" ["attachment_id"]=> int(0) ["name"]=> string(0) "" ["static"]=> string(0) "" ["pagename"]=> string(0) "" ["page_id"]=> int(0) ["second"]=> string(0) "" ["minute"]=> string(0) "" ["hour"]=> string(0) "" ["day"]=> int(0) ["monthnum"]=> int(0) ["year"]=> int(0) ["w"]=> int(0) ["category_name"]=> string(0) "" ["cat"]=> string(0) "" ["tag_id"]=> int(23) ["author"]=> string(0) "" ["author_name"]=> string(0) "" ["feed"]=> string(0) "" ["tb"]=> string(0) "" ["paged"]=> int(0) ["meta_key"]=> string(0) "" ["meta_value"]=> string(0) "" ["preview"]=> string(0) "" ["s"]=> string(0) "" ["sentence"]=> string(0) "" ["title"]=> string(0) "" ["fields"]=> string(0) "" ["menu_order"]=> string(0) "" ["embed"]=> string(0) "" ["category__in"]=> array(0) { } ["category__not_in"]=> array(0) { } ["category__and"]=> array(0) { } ["post__in"]=> array(0) { } ["post__not_in"]=> array(0) { } ["post_name__in"]=> array(0) { } ["tag__in"]=> array(0) { } ["tag__not_in"]=> array(0) { } ["tag__and"]=> array(0) { } ["tag_slug__in"]=> array(1) { [0]=> string(17) "scenario-planning" } ["tag_slug__and"]=> array(0) { } ["post_parent__in"]=> array(0) { } ["post_parent__not_in"]=> array(0) { } ["author__in"]=> array(0) { } ["author__not_in"]=> array(0) { } ["meta_query"]=> array(0) { } ["post_type"]=> string(4) "post" ["ignore_sticky_posts"]=> bool(false) ["suppress_filters"]=> bool(false) ["cache_results"]=> bool(true) ["update_post_term_cache"]=> bool(true) ["lazy_load_term_meta"]=> bool(true) ["update_post_meta_cache"]=> bool(true) ["posts_per_page"]=> int(10) ["nopaging"]=> bool(false) ["comments_per_page"]=> string(2) "50" ["no_found_rows"]=> bool(false) ["order"]=> string(4) "DESC" } ["tax_query"]=> object(WP_Tax_Query)#1730 (6) { ["queries"]=> array(2) { [0]=> array(5) { ["taxonomy"]=> string(8) "post_tag" ["terms"]=> array(1) { [0]=> int(23) } ["field"]=> string(7) "term_id" ["operator"]=> string(2) "IN" ["include_children"]=> bool(true) } [1]=> array(5) { ["taxonomy"]=> string(8) "post_tag" ["terms"]=> array(1) { [0]=> string(17) "scenario-planning" } ["field"]=> string(4) "slug" ["operator"]=> string(2) "IN" ["include_children"]=> bool(true) } } ["relation"]=> string(3) "AND" ["table_aliases":protected]=> array(2) { [0]=> string(31) "wp_as01f6kGh9term_relationships" [1]=> string(3) "tt1" } ["queried_terms"]=> array(1) { ["post_tag"]=> array(2) { ["terms"]=> array(1) { [0]=> int(23) } ["field"]=> string(7) "term_id" } } ["primary_table"]=> string(18) "wp_as01f6kGh9posts" ["primary_id_column"]=> string(2) "ID" } ["meta_query"]=> object(WP_Meta_Query)#1812 (9) { ["queries"]=> array(0) { } ["relation"]=> NULL ["meta_table"]=> NULL ["meta_id_column"]=> NULL ["primary_table"]=> NULL ["primary_id_column"]=> NULL ["table_aliases":protected]=> array(0) { } ["clauses":protected]=> array(0) { } ["has_or_relation":protected]=> bool(false) } ["date_query"]=> bool(false) ["request"]=> string(907) "SELECT SQL_CALC_FOUND_ROWS wp_as01f6kGh9posts.* FROM wp_as01f6kGh9posts LEFT JOIN wp_as01f6kGh9term_relationships ON (wp_as01f6kGh9posts.ID = wp_as01f6kGh9term_relationships.object_id) LEFT JOIN wp_as01f6kGh9term_relationships AS tt1 ON (wp_as01f6kGh9posts.ID = tt1.object_id) JOIN wp_as01f6kGh9icl_translations t ON wp_as01f6kGh9posts.ID = t.element_id AND t.element_type = CONCAT('post_', wp_as01f6kGh9posts.post_type) WHERE 1=1 AND ( wp_as01f6kGh9term_relationships.term_taxonomy_id IN (23) AND tt1.term_taxonomy_id IN (23) ) AND wp_as01f6kGh9posts.post_type = 'post' AND (wp_as01f6kGh9posts.post_status = 'publish') AND ( ( t.language_code = 'en' AND wp_as01f6kGh9posts.post_type IN ('post','page','portfolio' ) ) OR wp_as01f6kGh9posts.post_type NOT IN ('post','page','portfolio' ) ) GROUP BY wp_as01f6kGh9posts.ID ORDER BY wp_as01f6kGh9posts.post_date DESC LIMIT 0, 10" ["post_count"]=> int(0) ["current_post"]=> int(-1) ["in_the_loop"]=> bool(false) ["comment_count"]=> int(0) ["current_comment"]=> int(-1) ["found_posts"]=> int(0) ["max_num_pages"]=> int(0) ["max_num_comment_pages"]=> int(0) ["is_single"]=> bool(false) ["is_preview"]=> bool(false) ["is_page"]=> bool(false) ["is_archive"]=> bool(true) ["is_date"]=> bool(false) ["is_year"]=> bool(false) ["is_month"]=> bool(false) ["is_day"]=> bool(false) ["is_time"]=> bool(false) ["is_author"]=> bool(false) ["is_category"]=> bool(false) ["is_tag"]=> bool(true) ["is_tax"]=> bool(false) ["is_search"]=> bool(true) ["is_feed"]=> bool(false) ["is_comment_feed"]=> bool(false) ["is_trackback"]=> bool(false) ["is_home"]=> bool(false) ["is_404"]=> bool(false) ["is_embed"]=> bool(false) ["is_paged"]=> bool(false) ["is_admin"]=> bool(false) ["is_attachment"]=> bool(false) ["is_singular"]=> bool(false) ["is_robots"]=> bool(false) ["is_posts_page"]=> bool(false) ["is_post_type_archive"]=> bool(false) ["query_vars_hash":"WP_Query":private]=> string(32) "ccf7409a2312c5b989420dd006255bf1" ["query_vars_changed":"WP_Query":private]=> bool(true) ["thumbnails_cached"]=> bool(false) ["stopwords":"WP_Query":private]=> NULL ["compat_fields":"WP_Query":private]=> array(2) { [0]=> string(15) "query_vars_hash" [1]=> string(18) "query_vars_changed" } ["compat_methods":"WP_Query":private]=> array(2) { [0]=> string(16) "init_query_flags" [1]=> string(15) "parse_tax_query" } } Nothing Found Sorry, no posts matched your criteria
- This reply was modified 7 years, 6 months ago by Hesi. Reason: wrong URL
Sorry, I will take it out from the function.php, because in normal seaerch are to many layout-bugs. In the enfold forum I found this post: https://www.kriesi.at/support/topic/relevanssi-and-blog-tags/
I don’t need to see it on the live page, just seeing what it prints out is enough.
For some reason that query appears as a search, even though it isn’t. However, that function returning “false” should make the tag page work, if the problem was with Relevanssi blocking it, so I don’t know, that doesn’t make much sense to me.
So I’ll just have to say sorry, I’ve got no idea why this isn’t working. I’d need to be able to dig into this and do some debugging on an actual site to understand what’s happening here.
- The topic ‘Relevanssi prevents keyword output’ is closed to new replies.