[wp-hackers] Appending Query Strings to Pretty Permalinks

Chip Bennett chip at chipbennett.net
Mon Mar 7 20:21:53 UTC 2011


Even better; thanks!

Chip

On Mon, Mar 7, 2011 at 2:14 PM, John Blackbourn <johnbillion+wp at gmail.com>wrote:

> 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
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list