Skip Navigation

[Resolved] View filter by shortcode attribute has stopped working

This thread is resolved. Here is a description of the problem and solution.

Problem: I have a View with a post relationship Query Filter set by a shortcode attribute. After updating, the Query Filter is not working as expected.

Solution: Remove the wpv-control-post-relationship filter shortcode from the View's Custom Search editor panel.

This support ticket is created 3 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 10 replies, has 2 voices.

Last updated by envista-imagen-s.l.M 3 years, 10 months ago.

Assisted by: Christian Cox.

Author
Posts
#1903897

I am trying to: After updating a filter stopped working

Link to a page where the issue can be seen: hidden link

I expected to see: only doctors in that filter, 4 doctors: hidden link

Instead, I got: A list with all doctors not filtered

#1903899

not solved

#1904359

Hi, the first thing I see when I log into the site is a message that Toolset needs to update the database . Have you made a backup of the site? If you have a backup, I suggest running the database update mentioned in the big notice at the top of the Toolset dashboard page. Once updated, we can look at the filters here.

#1905051

Hi, backup done and database updated 🙂
but still not working as expected, could you have a look please?
thanks

#1906661

I don't see anyting obviously wrong here, the View's post relationship filter is set up to respond to a shortcode attribute and that seems to be in place in the Divi design. I'd like to run some additional tests by creating a site clone and installing it in my local environment. I wanted to get your approval first, since I'll need to install the Duplicator plugin to create that site clone. Let me know if you approve, and I can get started.

#1908117

You say: "the View's post relationship filter is set up to respond to a shortcode attribute and that seems to be in place in the Divi design", but is not <b>filtering</b>.

I explain myself again in case before was not clear: The thing wrong is that here: hidden link

I have a filter to show only doctors from the 304 especialty:
{!{wpv-view name='lista-de-especialistas-by-especialidad-policlinicas' especialidad='304'}!}

but instead of filtering the shortcode is showing the full doctors list. To be working fine it should show only these 4 doctors: hidden link

but instead, I get a full list, so filter is not working properly.

yes, you have my approval for installing that plugin 🙂
Thanks for your time and your attention.

#1908205

Yes thanks for the details and clarification, I understand the problem is that this View is not filtering correctly based on the post relationship filter shortcode attribute. I will create the site clone and continue my investigation.

#1908235

Okay after installing the site clone and running some tests, I was able to find the source of the problem. It seems that this View includes a front-end post relationship filter shortcode:

[wpv-control-post-relationship ancestors="especialidad@especialidad-de-especialista.parent" url_param="wpv-relationship-filter"]...[/wpv-control-post-relationship]

However, since you have implemented a shortcode attribute for the post relationship filter, this shortcode should be removed from the View's Búsqueda y paginación editor. The filter shortcode is overriding the shortcode attribute, and causing a problem in the filtering system. In my local clone, I was able to fix the problem by removing the shortcode. May I try removing the shortcode on the live site to see if the problem is resolved? Or you can try to remove the shortcode if you'd prefer. Be sure to remove the closing shortcode as well as the opening shortcode.

#1908493

yes, you have permission to try to remove the shortcode on the live site 🙂
thanks

#1908521

Okay great, thanks. This seems to have resolved the problem on the live site. Old code:

[wpv-filter-start hide="false"]
[wpv-filter-controls]
[wpv-control-post-relationship ancestors="especialidad@especialidad-de-especialista.parent" url_param="wpv-relationship-filter"]
<div class="row filters_container">
  <div class="col-md-5">
    <div class="form-group">
      <div class="select_container">
        [aseguradoras-select label="Filtrar por aseguradora" class="select_filter"]
      </div>
      <div class="submit_container">
        [wpv-filter-submit name="Aplicar filtro" output="legacy" class="submit_filter"]
      </div>
    </div>
  </div>
  <div class="col-md-5 col-md-offset-2">
    <div class="form-group">
      <div class="search_container">
        [wpv-filter-search-box output="legacy" class="search_filter" placeholder="Introduce un nombre a buscar"]
      </div>
    </div>
  </div>
</div>
[/wpv-control-post-relationship][/wpv-filter-controls]
[wpv-filter-end]

New code:

[wpv-filter-start hide="false"]
[wpv-filter-controls]
<div class="row filters_container">
  <div class="col-md-5">
    <div class="form-group">
      <div class="select_container">
        [aseguradoras-select label="Filtrar por aseguradora" class="select_filter"]
      </div>
      <div class="submit_container">
        [wpv-filter-submit name="Aplicar filtro" output="legacy" class="submit_filter"]
      </div>
    </div>
  </div>
  <div class="col-md-5 col-md-offset-2">
    <div class="form-group">
      <div class="search_container">
        [wpv-filter-search-box output="legacy" class="search_filter" placeholder="Introduce un nombre a buscar"]
      </div>
    </div>
  </div>
</div>
[/wpv-filter-controls]
[wpv-filter-end]

Now I see 4 posts appear in the results. Let me know if i've overlooked anything.

#1908915

great Christian!
thank you very much for your help 🙂