我正在使用自定义简码插件。该插件允许我运行一些 php。php 查询非 wp 数据库以构建车辆规格页面,一切正常。问题是页面标题和描述所需的所有信息都包含在来自数据库的数据中。我已经尝试了一些标准的 wp php 过滤器,但标题没有改变。
这可能不是因为短代码的执行时间吗?
TinyMCE in WP admin. Shortcode
-----------------------------------------------
[myplugin data_id='42']
PHP window in shortcode editor
-----------------------------------------------
$GP=array_merge($_GET, $_POST);
echo "hello word" //works
echo $data_id; //works
echo $GP[some_post_data]; //works
//connect to database (irrelevant)
echo "the title from data table for data_id 42 = ".$data[title]; //works
// the following has no effect on page title even though $data[title] contains valid data
add_filter('the_title','myCallback');
function myCallback($data){
return $data[title];
}