wordpress判断是否启用伪静态或固定链接类型

2020年2月14日 飞飞 阅读(999)
知识付费主题,优惠促销中:xx-blog主题

有时候需要判断wordpress站点是否设置了伪静态,即后台固定链接设置中的选择了非”默认”的结构。
下面看一下判断方法

<?php
if(get_option('permalink_structure') == ''){
echo '使用的是默认设置';
}elseif(get_option('permalink_structure') == '/%year%/%monthnum%/%day%/%postname%/'){
echo '日期和名称型';
}elseif(get_option('permalink_structure') == '/%year%/%monthnum%/%postname%/'){
echo '月份和名称型';
}elseif(get_option('permalink_structure') == '/archives/%post_id%'){
echo '数字型';
}elseif(get_option('permalink_structure') == '/%postname%/'){
echo '文章名';
}else{
echo '自定义结构';
}
?>

若是只写get_option(‘permalink_structure’) 判断是否是自定义结构


关注微信公众号『xx主题网

第一时间了解最新网络动态
关注博主不迷路~

未经允许不得转载:xx主题网 » wordpress判断是否启用伪静态或固定链接类型
分享到:

评论抢沙发

要发表评论,您必须先

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏

扫码关注微信公众号

扫描关注xx主题网