• Wordpress automatically inserts the <br /> tag into the text, I tried to enter it in the “Allowed tags in excerpts” field, but the plugin only understands <br>, and in the search results I still get .../> text. Is it possible to do something in this situation? Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Mikko Saari

    (@msaari)

    Can you please provide some context? How does WordPress insert the <br /> tags? What does the text look like before the tags are inserted? Relevanssi should strip all the tags from the text, and if you enter <br> in the allowed tags field, that also includes <br />. There’s something else going on in here.

    Thread Starter DS

    (@dosolnce)

    I took screenshots, but I don’t see any options to insert the image here. My site: dosolnce.ru. The search on the site will give the result only if you enter a query in Russian. I also found "<p>..text "in some results, I don’t understand why.

    Plugin Author Mikko Saari

    (@msaari)

    I tried a bunch of searches, and could not see that happening at all. Can you please give me an example of a search that does that?

    In general these kinds of problems happen when there’s something unusual in how the posts and excerpts are built. By usual I mean that there are no extra plugins involved, and the theme search results template uses the_excerpt() to print out the excerpts.

    Thread Starter DS

    (@dosolnce)

    Yes, I use the_excerpt():

    <?php while (have_posts()) : the_post(); ?>
    
    		<div <?php post_class(); ?> id="postid-<?php the_ID(); ?>">
    			<h2><a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    			<div class="entry clearfix"><?php the_excerpt(); ?> <span id="breadcrumbs">(<?php the_category(', ');?>)</span></div>
    		</div>
    
    	<?php endwhile; ?>

    I created an entry for you with screenshots: https://dosolnce.ru/uncategory/search-test. Tags are displayed incorrectly selectively. Not only for different queries, but also within one, for example, for the queries “мама”, “дож”, “люблю”,” смерть” (“mom”, “doge”, “love”, “death”) …etc. Surprisingly, when I disabled the plugin, the search results were displayed perfectly, without these tags. Now I turned it on again – and the errors were repeated again.

    • This reply was modified 3 years, 6 months ago by DS. Reason: edit
    Plugin Author Mikko Saari

    (@msaari)

    I tried reproducing this problem on my test site, but I can’t make it happen like that.

    Does the problem go away if you set “Allowable tags” to empty? That should break the poem lines, but do the tag remains disappear, too? What if you set “Allowable tags” to just <br>? <p> is rarely a good idea to have there, that has a tendency to mess up excerpts.

    Thread Starter DS

    (@dosolnce)

    Yes, I have already tried to change the settings, remove tags from the allowed ones, add different combinations of tags, but it did not help. Thank you for trying to help. Apparently, I’ll have to disable the plugin.. still, it would be interesting to solve this riddle.

    Plugin Author Mikko Saari

    (@msaari)

    What if you just disable the custom excerpts in Relevanssi? That should solve this problem, right?

    There’s something unusual in your site, so I would recommend trying to disable other plugins and you can also try to search while live previewing one of the WP default themes to see if the problem is caused by your theme.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Allowed tags in excerpts’ is closed to new replies.