
使用WP_Query的基础知识 + 代码示例
_config_wp_home ( $url = '' )
config_wp_home: 这个函数用于配置当前网站的主页URL。它接受一个URL作为其参数,并更新网站的主页URL选项。
检索WordPress主页的URL。
如果名为’WP_HOME’的常量存在,那么它将被使用并被该函数返回。这可以用来对抗你本地开发环境中的重定向。
function _config_wp_home( $url = '' ) { if ( defined( 'WP_HOME' ) ) { return untrailingslashit( WP_HOME ); } return $url; }