[wp-trac] [WordPress Trac] #10616: post queries are not working with custom permalinks

WordPress Trac wp-trac at lists.automattic.com
Sat Aug 15 08:56:19 UTC 2009


#10616: post queries are not working with custom permalinks
--------------------------+-------------------------------------------------
 Reporter:  frumph        |       Owner:            
     Type:  defect (bug)  |      Status:  new       
 Priority:  high          |   Milestone:  Unassigned
Component:  Template      |     Version:  2.8.4     
 Severity:  major         |    Keywords:            
--------------------------+-------------------------------------------------

Comment(by frumph):

 Setting it as global doesnt help, $archive_year is still empty.

 You probably were thinking $archive_year would return the last value it
 was set but it does not, it's still empty.  Why? Because (isset(  returns
 false because it's thinking it's not set even though it's in the query
 line.

 Dont know if this will help but THIS works:

 {{{
   $archive_year = $_REQUEST['archive_year'];
   echo $archive_year;
                 <form method="post" action="">
                 <input type="hidden" name="archive_year" value="2001" />
                 <button type="submit" value="submit" name="submit">Click
 Me.</button></form>
 }}}

 echo $archive_year will echo out 2001.

 However, doing this doesnt work:

 {{{
 $archive_year = $_GET['archive_year'];

 echo $archive_year;

 <a href="http://www.domain.com/archive/comics-by-
 year/?archive_year=2001">2001</a>
 }}}
 $archive_year is "UNSET" if isset returns false if I were to add that.

 ^^ the href which is:
 <a href="<?php echo add_query_arg('archive_year', $year) ?>"><strong><?php
 echo $year ?></strong></a>

 where $year == 2001;

 .. Turning Permalinks Off
 {{{
 $archive_year = $_GET['archive_year'];

 echo $archive_year;

 <a href="http://www.domain.com/?page_id=12846&archive_year=2001">2001</a>
 }}}
 This works, $archive_year returns 2001

 it's when I set the permalinks on it doesnt work on page-templates

 tested on all templates that we use, same thing.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/10616#comment:13>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list