Kedar B
Kedar B

Reputation: 784

Passing key to add_query_arg function in wordpress

This is my edit link in template file

$edit_link=add_query_arg( 'ser_edit', $post_id, $edit_link ) ;

This is my html code.

 <a href="<?php  print $edit_link;?>"><?php _e('Edit','wpestate');?></a>

When I change first parameter in add_query_arg, It works fine but ser_edit is the correct parameter for that. But it display blank page when I click on edit link in html. I checked console, no error. Anybody has any idea??

It display correct url in browser but display total blank page. When I change key parameter, it works fine. So how to solve this??

Upvotes: 0

Views: 1724

Answers (1)

Ankur Bhadania
Ankur Bhadania

Reputation: 4148

try this

if you want to pass single value in query arg

add_query_arg( 'ser_edit',$post_id,get_permalink() ) ;

And if you want to pass multiple value in query arg

add_query_arg(array('arg1'=>'value1','arg2'=>'value2'), get_permalink());

Upvotes: 1

Related Questions