WordPress.org

Ready to get started?Download WordPress

Forums

Query Multiple Taxonomies
Custom reset (3 posts)

  1. LJ902
    Member
    Posted 3 years ago #

    Hi Scribu

    Sorry about this but I seem to be having problems with the custom reset (again)

    I had it sorted after your help in this thread:

    http://wordpress.org/support/topic/plugin-query-multiple-taxonomies-custom-reset-not-working?replies=8

    I have two custom post types - 'snapshots' and 'resources' each displayed on separate pages and each requiring their own custom reset to return the user to the page in question. This worked perfectly a few weeks back but I've been working on a seperate part of the site (actually a joomla installation so I haven't really touched much of the wordpress installation since I got it sorted).

    Now, when I try to use the widget, the searching all works just fine, but for some reason the reset takes the user to a 404 page. The weird thing is that when I hover over the reset button it displays a link to http://www.mysiteurl.com/post1 where post1 is the last post in the list that the plugin generates.

    Can you think of any reason why this should be? I've wracked my brains and reversed just about every change I've made to the site that I can think of. I've set up a redirect to a subdomain using htaccess (excepting my IP of course) during development which I thought might be the problem but I disabled this and the problem remains.

    I've reinstalled the plugin a couple of times (v.1.3.1-alpha3) deleted and reinstated the widget and I'm using this code in my functions file to set up the custom reset:

    <?php
    function my_qmt_base_url( $url ) {
    	// Get the list of queried taxonomies
    	$tax_names = array_keys( qmt_get_query() );
    
    	// Choose page ID
    	if ( in_array( 'job_types', $tax_names ) || in_array( 'location', $tax_names ) || in_array( 'expertise', $tax_names ) )
    		$page_id = 5;
    	elseif ( in_array( 'resource_subjects', $tax_names ) || in_array( 'resource_types', $tax_names ) )
    		$page_id = 86;
    	// etc.
    
    	return get_page_link( $page_id );
    }
    add_filter( 'qmt_reset_url', 'my_qmt_base_url' );
    ?>

    Any help most appreciated! Going to try nuking everything to do with htaccess redirects, QMT and anything else I can think of that might be screwing with it but wanted to see if you had any ideas first.

  2. scribu
    Member
    Plugin Author

    Posted 3 years ago #

    I think you got one of the page ids wrong or something, causing get_page_link() to use the current post, which in this case would be the last post in the loop.

  3. LJ902
    Member
    Posted 3 years ago #

    Thanks Scribu, but I just can't work this out! Checked and double checked page ids (no change) and for good measure I deleted the pages and created new ones (again, no change.

    It's bizarre as it was all working fine about a month ago so it's obviously something that I've done or installed in the interim. I've disabled all the plugins I can think of, completely scrapped the subdomain I was redirecting to, taken htaccess down to just the permalinks instructions wordpress generates.

    I tried building it up from the beginning (i.e. starting with just the plugin). Then I added the page redirect to just page e.g.

    <?php
    function my_qmt_base_url() {
    	return get_page_link( 126 );
    }
    add_filter( 'qmt_reset_url', 'my_qmt_base_url' );
    ?>

    Which all works fine (proving the page id is correct) but when I try and add two resets to different pages depending on the taxonomy in play e.g.

    <?php
    function my_qmt_base_url( $url ) {
    	// Get the list of queried taxonomies
    	$tax_names = array_keys( qmt_get_query() );
    
    	// Choose page ID
    	if ( in_array( 'job_types', $tax_names ) || in_array( 'location', $tax_names ) || in_array( 'expertise', $tax_names ) )
    		$page_id = 126;
    	elseif ( in_array( 'resource_subjects', $tax_names ) || in_array( 'resource_types', $tax_names ) )
    		$page_id = 129;
    	// etc.
    
    	return get_page_link( $page_id );
    }
    add_filter( 'qmt_reset_url', 'my_qmt_base_url' );
    ?>

    I get the problem of it linking to the current post. Can't really think of anything else to try - anyone else out there having/had the same problem?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic