Passing key to add_query_arg function in wordpress

2019-09-10 01:17发布

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??

标签: php wordpress
1条回答
戒情不戒烟
2楼-- · 2019-09-10 01:21

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());
查看更多
登录 后发表回答