如何获取页面的当前路径?
我知道如何在模板文件中完成,但我需要它functions.php
.而且必须在send_headers
钩子,因为我将使用此信息设置cookie。
我尝试使用PHP,但我/wp-admin
如何获取页面的当前路径?
我知道如何在模板文件中完成,但我需要它functions.php
.而且必须在send_headers
钩子,因为我将使用此信息设置cookie。
我尝试使用PHP,但我/wp-admin
//get current page\'s path
$pagePath = parse_url( $_SERVER[\'REQUEST_URI\'] );
$pagePath = $pagePath[\'path\'];
$pagePath = substr($pagePath, 1, -1);//remove slashes
Wordpress为内置的gallery功能输出了一些非常糟糕的代码,这已经被谈论了很多次了。这是负责库输出的核心代码(在/wp-includes/media.php中):function gallery_shortcode($attr) { global $post; static $instance = 0; $instance++; // Allow plugins/themes to override the de