Php $\u GET在wp customizer中不工作
我正在使用Php $\u GET在wp customizer中不工作,php,wordpress,get,Php,Wordpress,Get,我正在使用wp\u footer操作在站点顶部显示一个栏 我使用并获取了自定义程序url中的条id,但它没有返回任何内容 下面是我的代码: add_action( 'wp_footer', 'jws_ob_content'); function jws_ob_content() { if( is_customize_preview() ) { $offer = get_post( $_GET['offer_id'] ); $offer_custom = get_po
wp\u footer
操作在站点顶部显示一个栏
我使用并获取了自定义程序url中的条id,但它没有返回任何内容
下面是我的代码:
add_action( 'wp_footer', 'jws_ob_content');
function jws_ob_content() {
if( is_customize_preview() ) {
$offer = get_post( $_GET['offer_id'] );
$offer_custom = get_post_custom( $_GET['offer_id'] );
echo "<pre>";
print_r( $_GET['offer_id'] );
exit();
}
else {
$offer = get_post('505');
$offer_custom = get_post_custom('505');
}
}
add_action('wp_footer','jws_ob_content');
函数jws_ob_content(){
如果(是自定义预览()){
$offer=get_post($_get['offer_id']);
$offer\u custom=get\u post\u custom($u get['offer\u id']);
回声“;
打印($获取['offer\u id']);
退出();
}
否则{
$offer=get_post('505');
$offer_custom=get_post_custom('505');
}
}
我通过编写和自动聚焦[panel]=something对url进行了编码,url的结尾很好。方法is\u customize\u preview()
do?如果它是customizer,customize\u preview()是否返回true。检查print\r($\u REQUEST)代码>?vrajesh检查更新的代码返回此数组([页面id]=>519[自定义变更集uuid]=>47cffcc9-3a55-4b35-887c-4e8497ff9da9[自定义主题]=>217[自定义信使频道]=>preview-0)