[wp-hackers] Appending Query Strings to Pretty Permalinks

John Blackbourn johnbillion+wp at gmail.com
Mon Mar 7 20:14:59 UTC 2011


On 7 March 2011 20:04, Chip Bennett <chip at chipbennett.net> wrote:
> I KNEW there had to be a WP-supported way.
>
> So, something like this:
>
> echo add_query_arg( 'all', '1', get_permalink() );
>
> Thanks!
>
> Chip

If you get into the habit of using the array method then it gives you
consistency when adding more than one argument. Just noticed I typoed
my original example, so here is a better example:

$link = add_query_arg( array( 'all' => '1' ), get_permalink() );

If you want to add more than one paramter, you do this:

$link = add_query_arg( array( 'all' => '1', 'foo' => 'bar' ), get_permalink() );

John


More information about the wp-hackers mailing list