Problems with the default Search Block

  • Hi there, I’m trying to integrate a site search on my blog using the existing WordPress Search Block component.

    Here are my search results for the term “blog” on my 3,000+ old posts (where I’ve said it hundreds of times before) but it doesn’t return any results, which seems like a major bug. Am I doing something wrong here?

    The blog I need help with is: (visible only to logged in users)

  • Hi there!

    It looks like you’re missing the Query Loop block in your Search template. Without the query loop, it’s not possible to display any search results.

    Go to Appearance -> Editor and select the template from the top center of the page, then click “Browse all templates”:

    Then, choose the “Search” template and insert a query block underneath the “Search Title Results” heading, then save the changes.

    That should fix it! Let us know if you still have trouble.

  • Hmmm, I’m not seeing a search query results loop as any of the options.

    Here’s a screenshot of what I get in the new block template editor when I put in the word “search”:

    I have an option for the search box, and the search title. No query results appear as an option. I even tried a new query loop but couldn’t figure out how to make it parse search results.

    I’ll try to move search back to the default and start over, but I’m not seeing any options to add results as a block.

  • Doing some more digging, and I believe this is an error with the template by the designer of it. I picked a nice clean template from the WordPress options on WordPress, but when I reverted the search page to the original, the editor shows a block error that says:

    This block contains unexpected or invalid content.

    So I was trying the “Attempt block recovery” option to no avail. Strangely, the template works now that I reverted it, but the results loop still shows up as an error in the editor.

  • Hi there,

    Is it possible this is no longer an issue as well? When I check on your template I do not see the “block recovery” message. Do you still see it if you look here? Search template edit page

    Thanks!

  • I have this problem on the Pendant theme on WordPress.com on my blog, how can I fix this, I had no problems with the non-full site editing themes?

  • Hello John,

    What are you search for exactly?

    As above, I can see results on a page when I search for something in the site, so I’m curious to see what you’re seeing.

    Also, what browser and version is in use?

  • Hello Aleone89,

    I tried typing random things that I know that I have posts about like: Dune, Dreams, Saints Row, just random things like that.

    The screen flashes real quick after I click Search or press Enter, but it only shows the same posts that are already on my home page et cetera; and the address bar will say something like: https://johnjronline.wordpress.com/?s=Dune (whatever the search term was).

    I tried it on the latest Microsoft Edge and Brave Browser on Windows 11, I use AdGuard For Windows with the DNS set to Adguard DNS, and in my web browsers I am using the web browser extensions: Malwarebytes Browser Guard, LanguageTool, Video DownloadHelper, and AdGuard Browser Assistant.

    Thank you,

    • John Jr
  • @mathowie, can you go to the Search Template page and attempt block recovery? It should bring back the Query Loop Block. Click on that and make sure it’s set to inherit query from template. Then save your changes, and if that still isn’t showing the correct results, please update us here.

  • John Jr, I took a look at your site, and its Query Loop does not have that “inherit query from template” option toggled. Can you edit the template, use the list view to click the Query Loop block, and adjust that setting? I believe toggling that and saving should fix the issue on your site, though I’m not sure how it was untoggled to begin with.

  • Hello Supernovia,

    Thank you for trying to help me, I have been using WordPress.com for over a decade, but the new full site editing & themes have been an issue for me & lack things that used to be available in previous themes that I like to use & it much more confusing & scattered; so I have been avoiding them & it mostly.

    I did not find the recover block option, I did use the browse template option, clicked on Search & clicked Clear Customizations.

    I also found the Query Loop setting & turned that on, saved, refreshed my home page & another page, tried to search again, and it still did not work, surprisingly.

  • Hi @johnjronline were you able to follow supernovia’s suggestion to activate the “inherit query from template” option for your Query Loop, when you’re editing your Search template at this link below?
    https://johnjronline.wordpress.com/wp-admin/site-editor.php?postType=wp_template&postId=pub%2Fpendant%2F%2Fsearch

    The suggestion to “recover block” was aimed at the original poster (mathowie) rather than yourself so I’m not too sure it would work in your case. If you can check the Search template once more to ensure that the “inherit query from template” setting is active, that should normally resolve the issue with your search not working.

    There’s a little more information about what that setting does in this guide:
    https://wordpress.com/support/site-editing/theme-blocks/query-loop-block/#settings

  • Hello,

    I thought that I did, I had even clicked Save & everything yesterday after enabling the Query Loop setting to inherit the themes whatever, but it did not work.

    This was necessarily difficult to find, but I managed to find the Query Loop setting again in list view, I thought that it would be among the Search area & Search block settings, but it was its own hidden setting in the List View oddly.

    It was somehow disabled again, so I enabled it again, saved twice, and it finally worked this time.

    Thank you.

    I wish most themes came with a built-in search option in the header, like the Twenty Twenty theme, et cetera.

    How do we even go about adding something like that into these new confusing Full Site Editing themes on WordPress.com free accounts?

    I might make a new thread eventually asking for help how to add simple things that some previous older themes used to come with.

    I used to change themes often & look forward to new free themes each month on WordPerss.com, but as the direction of themes changed in the last few years, barely any fit my needs anymore, leaving me with few options but some older themes since even the default themes stopped having the options that I want in themes.

    Hopefully, the new theme system gives me a way to restore old options as much as I can for free themes, if I can learn to make some sense of it.

  • @johnjronline if you don’t mind making a separate thread for each issue, we’ll track them and go from there.

    For this thread, let’s go ahead and let the original poster get their situation sorted without unrelated notifications. Cheers!

  • Thanks, I might try to get myself to do that one day, have a nice day.

  • The topic ‘Problems with the default Search Block’ is closed to new replies.