我是WP的新手,我自己找不到这个解决方案。
这是我的职责,
function explodetitletotags() {
global $post;
$title = $post->post_title;
$tags = explode(\' \', preg_replace(\'/[^\\p{L}0-9 ]/\', \' \', $title));
foreach $tags as $tag {
global $post;
$thePostID = $post->ID;
wp_add_post_tags($thePostID, $tag);
}
}
add_action(\'publish_post\', \'explodetitletotags\');
除了
When the post title in the new single post page updated, 标题总是给出以前的值,而不是上次我在输入标题框中键入的值。
我的假设是,$title = $post->post_title;
在我的函数中,从数据库中调用旧版本的标题,而不是新版本,我想为什么不在标题发送到数据库之前抓取它,以便标题始终是最新版本,这样可以吗?
如果是,在将wordpress保存到wp\\U posts表数据库之前,是否有方法在Post保存时拦截/捕获wordpress?
我很抱歉我的英语,因为它不是我的第一语言,谢谢你的帮助。