Php Wordpress-get_permalink在%postname%permalink设置中返回页面id而不是slug
所以,我有wordpress网站http://example.com/%postname%/ 在永久链接设置中 我想让echo得到permalink,哪一个显示http://example.com/?page_id=xx 结果 但当我得到echo permalink时,它又回来了http://example.com/some-slug/. 我知道这不是一个错误,因为永久链接设置是%postname% 我想这样使用它: 回声 要使链接结果如下所示: 而不是这个结果: 那么,是否有可能得到的结果http://example.com/?page_id=xx 使用%postname%或其他permalink设置选项作为permalink回显get_permalink时 背景请解释一下怎么做Php Wordpress-get_permalink在%postname%permalink设置中返回页面id而不是slug,php,wordpress,Php,Wordpress,所以,我有wordpress网站http://example.com/%postname%/ 在永久链接设置中 我想让echo得到permalink,哪一个显示http://example.com/?page_id=xx 结果 但当我得到echo permalink时,它又回来了http://example.com/some-slug/. 我知道这不是一个错误,因为永久链接设置是%postname% 我想这样使用它: 回声 要使链接结果如下所示: 而不是这个结果: 那么,是否有可能得到的结果
谢谢。只需手动创建url即可
<?php
$url = add_query_arg( array('page_id' => get_the_ID(), 'get_weather' => 'rain'), home_url('/') );
?>
只是对这一点感到困惑,而不是思考您的非常简单的代码!