Wordpress 从 MySQL 获取文章链接 permalinks

SELECT wpp.post_title, wpp.guid, wpp.post_date,
       REPLACE( REPLACE( REPLACE( REPLACE( wpo.option_value, '%year%', DATE_FORMAT(wpp.post_date,'%Y') ), '%monthnum%', DATE_FORMAT(wpp.post_date, '%m') ), '%day%', DATE_FORMAT(wpp.post_date, '%d') ), '%postname%', wpp.post_name ) AS permalink
  FROM wp_posts wpp
  JOIN wp_options wpo
    ON wpo.option_name = 'permalink_structure'
 WHERE wpp.post_type = 'post'
   AND wpp.post_status = 'publish'
 ORDER BY wpp.post_date DESC;

 

效果如下:

 

 

资料来源:

http://yllus.com/2015/12/08/how-to-get-wordpress-post-permalinks-directly-from-the-mysql-database/#comment-339287

posted @ 2019-04-24 18:17  Ryan_zheng  阅读(310)  评论(0编辑  收藏  举报