将密钥传递给 wordpress 中的 add_query_arg 函数 [英] Passing key to add_query_arg function in wordpress

查看:39
本文介绍了将密钥传递给 wordpress 中的 add_query_arg 函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我在模板文件中的编辑链接

This is my edit link in template file

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

这是我的 html 代码.

This is my html code.

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

当我更改 add_query_arg 中的第一个参数时,它工作正常,但 ser_edit 是正确的参数.但是当我单击 html 中的编辑链接时,它显示空白页.我检查了控制台,没有错误.有人有什么想法吗??

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

推荐答案

试试这个

如果你想在查询参数中传递单个值

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

如果你想在查询参数中传递多个值

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

这篇关于将密钥传递给 wordpress 中的 add_query_arg 函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆