Skip Navigation

[Closed] bug in wpv_filter_shortcode_start() ?

This support ticket is created 11 years, 7 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.

This topic contains 2 replies, has 2 voices.

Last updated by Christian 11 years, 6 months ago.

Assisted by: bruce.


Hi, I got this strange problem when displaying a Content Template on an archive page, everything was working correct and I set Layout Style to 'Table' with 'Include field names in table headings' and I got a nice table with headings.

But the Sort function wasn't working! When clicking on the headings I was linked to one of the pages listed in the table, but with the sorting parameters added to it (

I digged trough the source of the page and found that the 'wpv-filter-form ' that handle the sorting had the action-parameter set to the random subpage, and not the current url of the archive page that I was visiting.

I search the wp-views source and and found this, wpv_filter_shortcode_start() - the function that create to form for the sorting, use get_permalink() to set the ACTION-attribute for the form. Since get_permalink() doesn't work well outside the loop and can't give a correct self refering url on the page, it will return the URL of the last post in The Loop (the views table listing).

Since the ACTION parameter in this form always should point to the current 'page' I *belive* it would be better and ok to set it to an empty variable. A patch is enclosed here:

diff --git a/wp-content/plugins/wp-views/embedded/inc/wpv-filter-embedded.php b/wp-content/plugins/wp-views/embedded/inc/wpv-filter-embedded.php
index 29cad59..12919e2 100644
--- a/wp-content/plugins/wp-views/embedded/inc/wpv-filter-embedded.php
+++ b/wp-content/plugins/wp-views/embedded/inc/wpv-filter-embedded.php
@@ -35,8 +35,8 @@ function wpv_filter_shortcode_start($atts){
if (isset($atts['hide']) && $atts['hide'] == 'true') {
$hide = ' display:none;';
- $url = get_permalink();
+ $url = '';
$out = '<form style="margin:0; padding:0;' . $hide . '" id="wpv-filter-' . $WP_Views->get_view_count() . '" action="' . $url . '" method="GET" class="wpv-filter-form"' . ">\n";

// add hidden inputs for any url parameters.


Hi Christian,

We're aware of this and haven't decided how to handle it yet. Currently Views has been designed so that it works when a View is on a Post page. That's why we have used get_permalink() for this. We'll be looking into how to use Views on archive pages soon.

Can you tell me how you call your View or Content Template from an archive page.

Best regards,


Thanks for your prompt reply, here is my not that so quick reply 🙂 After working with views/types more I released that my take of using a customized archive-x.php was suboptimal. I instead created an "archive template page", and then everything worked as supposed.

(Oh well, I at least got an excuse for reviewing the plugins code and learn the inner mechanism, looking good :D)

The topic ‘[Closed] bug in wpv_filter_shortcode_start() ?’ is closed to new replies.