【发布时间】:2018-06-17 04:49:54
【问题描述】:
https://github.com/markjaquith/page-links-to
这是一个简单的 WordPress 插件,可在您单击帖子到自定义页面时重定向。
如何使用此函数或wordpress中的函数将帖子ID更改为带有PHP函数的重定向链接(基本上跳过用户界面)?
我会为这个插件使用这些功能之一吗(在同一页面或新标签中打开)?
或者是否有另一种方式我不必使用这个插件或它的功能并使用 wordpress 内置功能?
function set_link( $post_id, $url ) {
return $this->flush_links_if( (bool) update_post_meta( $post_id, self::LINK_META_KEY, $url ) );
}
/**
* Tell an custom URL post to open in a new tab
*
* @param int $post_id post ID
* @return bool whether anything changed
*/
function set_link_new_tab( $post_id ) {
return $this->flush_targets_if( (bool) update_post_meta( $post_id, self::TARGET_META_KEY, '_blank' ) );
}
【问题讨论】:
-
你能提供一个你想做的例子吗,因为有很多方法可以解释这个问题。
-
我想让post id ie 27去www.example.com/folder
-
每个帖子的永久链接,但使用函数来完成