Skip Navigation

[Resuelto] Don't include current page in query result Not Working in Views

This support ticket is created hace 3 años, 4 meses. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

Etiquetado: ,

This topic contains 7 respuestas, has 3 mensajes.

Last updated by jasonH-4 hace 3 años, 3 meses.

Assisted by: Minesh.

Autor
Mensajes
#1873645

I just upgraded to Toolset Views 3.3.4 and the "Don't include current page in query result" checkbox is no longer working. Even when this is checked, it shows the current page in the view. I'm assuming other people are having the same issue. Can you fix this in your next update, please?

#1874061

Jamal
Supporter

Languages: Inglés (English ) Francés (Français )

Timezone: Africa/Casablanca (GMT+00:00)

Hello and thank you for contacting the Toolset support.

I confirm this is a bug introduced on the latest release. I am escalating it to our 2nd Tier and I'll get back to you as soon as possible.

#1874063

Jamal
Supporter

Languages: Inglés (English ) Francés (Français )

Timezone: Africa/Casablanca (GMT+00:00)

Please use the following code as a workaround:

add_filter( 'wpv_filter_query', 'my_exclude_current_post', 99, 3 );

function my_exclude_current_post( $query_args, $view_settings, $views_id  ) {
  global $post;
  
  $my_views = array(18, 19);
  if ( in_array( $views_id, $my_views ) ) {
    $query_args['post__not_in'] = array( absint( $post->ID ) );
  }
  
  return $query_args;
}

Update line 6 with the IDs of your views. If you have doubts, please allow me temporary access to check this closely.

Check this article on how to add custom code https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/

#1874247

Thanks for the quick response. I have VERY MANY views that this affects, but it's not the end of the world to show the current page, so I may just leave it as is if you think this bug will be fixed fairly soon - in the next release?

Are you able to say that this issue will be fixed in the next release? Please let me know. Thanks so much!

#1874527

Jamal
Supporter

Languages: Inglés (English ) Francés (Français )

Timezone: Africa/Casablanca (GMT+00:00)

We can't, actually, say when this could be fixed. But, we need to make sure that, at least, we can provide a workaround until this is fixed. I'll be glad to help you implement this fix.

As you can see in this test site hidden link
I have created two views, one with the legacy editor and one with the block editor. I put both views on the page "Homepage" and as you can say the views return the other page on the site and does not return the current page. My views have IDs 18 and 19, and I put the custom code in Toolset->Settings->Custom Code, then I activated it.

I'll get back to you as soon as we have the developers' feedback regarding the bug.

#1875543

Jamal
Supporter

Languages: Inglés (English ) Francés (Français )

Timezone: Africa/Casablanca (GMT+00:00)

The issue is now escalated to the developers. We'll get back to you as soon as we have a fix or a patch.

#1879271

Minesh
Supporter

Languages: Inglés (English )

Timezone: Asia/Kolkata (GMT+05:30)

I would like to inform you that we release a set of hotfix version for Toolset plugins including the Toolset Views 3.3.5 that contains the fix for this issue.

*** Please make a FULL BACKUP of your database and website.***
Could you please update ALL Toolset plugins to it's latest officially released version. You can download the latest plugin release from your accounts page:
=> https://toolset.com/account/downloads/

#1883201

My issue is resolved. The update of Views fixed the bug. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.