• Resolved iohannis

    (@iohannis)


    It seems that after some update (I’m not sure when, I only just noticed), this plugin redirects to the taxonomy name, and ignores the slug, if it’s set. This used to be working, so the form was redirected to the taxonomy slug, but with the latest version, the form redirects to the taxonomy name.

    For instance, if I name a plugin taxonomy some_unique_plugin_tag but want to use the slug cool_tag, the filter form redirects to /some_unique_plugin_tag/filtered-tag instead of /cool_tag/filtered-tag.

    I hope this makes sense. Any help is much appreciated.

    https://www.ads-software.com/plugins/search-filter/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter iohannis

    (@iohannis)

    Here is an example page, using the shortcode in a widget to the right:

    https://www.amaravati.org/audio/

    Select any item from the dropdowns and submit, the redirect is using the name of each custom taxonomy (such as fpmtp_speakers should use the slug ‘speakers’).

    The site is using the permalink structure /%postname%/

    Saving permalinks again does not help.

    Thread Starter iohannis

    (@iohannis)

    For clarification, this is for custom taxonomies with rewrite->slug defined, different than the taxonomy slug itself.

    Thread Starter iohannis

    (@iohannis)

    I think I solved this, by editing the search-filter.php file, around line 865:

    //**due to some new wierd rewrite in WordPress, the first taxonomy which get rewritten to /taxonomyname/taxonomyvalue only uses the first value of an array - so do it manually
    	if(get_option('permalink_structure')&&($taxcount==0))
    	{
    		$key_taxonomy = get_taxonomy( $key ); // Get the taxonomy to see if there is a rewrite slug
    		$tax_path = (isset($key_taxonomy->rewrite)&&isset($key_taxonomy->rewrite['slug']))
    			?
    				$tax_slug."/".$taxs."/"
    			:
    				$key."/".$taxs."/";
    
    		$this->urlparams .= $tax_path;
    	}
    	else
    	{
    		if(!$this->hasqmark)
    		{
    			$this->urlparams .= "?";
    			$this->hasqmark = true;
    		}
    		else
    		{
    			$this->urlparams .= "&";
    		}
    		$this->urlparams .=  $key."=".$taxs;
    	}

    Previously, the slug was simply $tax_path = $key."/".$taxs."/"; – not looking for the rewrite slug (just taking the param from the request).

    I hope this can be of help – and hopefully the plugin can be amended for the next version?

    Thread Starter iohannis

    (@iohannis)

    A mistyping above, the $tax_slug is a variable I removed again. Updated:

    if(get_option('permalink_structure')&&($taxcount==0))
    	{
    		$key_taxonomy = get_taxonomy( $key );
    		$tax_path = (isset($key_taxonomy->rewrite)&&isset($key_taxonomy->rewrite['slug']))
    			?
    				$key_taxonomy->rewrite['slug']."/".$taxs."/"
    			:
    				$tax_path = $key."/".$taxs."/";
    
    		$this->urlparams .= $tax_path;
    	}
    Plugin Author DesignsAndCode

    (@designsandcode)

    Hey there thanks so much for this – there was clearly something wrong in the code, I’m looking to do an update in the next couple of days and will update to use the correct slug.

    Thanks

    Really thanks, It really bothered me and I was going to disable the plugin or remove custom slugs … please @designsandcode Update it.

    Plugin Author DesignsAndCode

    (@designsandcode)

    Hi all thanks for your patience – the new update has this fix in it.

    Thanks @iohannis – I modified your code slightly but that was spot on.

    Thanks
    Ross

    Thread Starter iohannis

    (@iohannis)

    @designsandcode glad to be of help ??

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Plugin not using taxonomy slug after update’ is closed to new replies.