wordpress判断是否启用伪静态或固定链接类型-尊龙APPIOS下载地址

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

2026-12-07 06:24:28投稿人:88集团在线大厅(防城港)有限公司围观56679次63 评论

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

有时候需要判断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’) 判断是否是自定义结构  。

展开阅读全文

投稿时间  :2022-05-26  最后更新:2022-09-05