高级自定义字段从 iframe url 获取 post ID
Advanced Custom Fields get post ID from iframe url
我正在使用高级自定义字段 (ACF) 来填充自定义 post 类型,页面中有一个 'email the supplier' link,它会打开一个包含联系表单的 iframe。我遇到的问题是表单发送到的电子邮件地址将特定于自定义 post 类型生成的自定义字段。
我在 iframe href 末尾使用 ?postid=<?php echo the_ID(); ?>
将 post ID 携带到 iframe 但我现在不知道如何从 url 调用正确的自定义字段。
例如iframe的url是mysite.com/supplier-contact-form/?postid=40
我试过:
<?php $postid = url_to_postid( $url ); ?>
<?php echo ($postid); ?>
但它返回值 0。
您正在查找 $GET 请求
<?php
$postid = $_GET['postid'];
echo $postid;
?>
我正在使用高级自定义字段 (ACF) 来填充自定义 post 类型,页面中有一个 'email the supplier' link,它会打开一个包含联系表单的 iframe。我遇到的问题是表单发送到的电子邮件地址将特定于自定义 post 类型生成的自定义字段。
我在 iframe href 末尾使用 ?postid=<?php echo the_ID(); ?>
将 post ID 携带到 iframe 但我现在不知道如何从 url 调用正确的自定义字段。
例如iframe的url是mysite.com/supplier-contact-form/?postid=40
我试过:
<?php $postid = url_to_postid( $url ); ?>
<?php echo ($postid); ?>
但它返回值 0。
您正在查找 $GET 请求
<?php
$postid = $_GET['postid'];
echo $postid;
?>