修改url permalink wordpress
我使用wordpress,我有以下问题 我使用URL: -www.mysite.com/page -www.mysite.com/cat/page -www.mysite.com/custompostype/post permalinks的值是修改url permalink wordpress,wordpress,permalinks,Wordpress,Permalinks,我使用wordpress,我有以下问题 我使用URL: -www.mysite.com/page -www.mysite.com/cat/page -www.mysite.com/custompostype/post permalinks的值是%category%/%postname%,一切正常,除了现在我必须使用两种语言我想进行如下配置: www.mysite.com/EN/page www.mysite.com/ES/cat/page www.mysite.com/BR/customp
%category%/%postname%
,一切正常,除了现在我必须使用两种语言我想进行如下配置:
- www.mysite.com/EN/page
- www.mysite.com/ES/cat/page
- www.mysite.com/BR/custompostype/post
/%lang%/%category%/%postname%/
我使用了wp_重写,但没有成功,你知道吗?现在我刚刚找到了解决问题的方法,我处理了会话
<?php function init_sessions() {
if (!session_id()) {
session_start();
} } add_action('init', 'init_sessions'); ?> <?php function detecta_idioma() { if($_SESSION["IDIOMA"]["actual"]=="") {
$_SESSION["IDIOMA"]["actual"]="ES";
$_SESSION["IDIOMA"]["abreviatura"]="";
$_SESSION["IDIOMA"]["nombre"]="Español";
$_SESSION["IDIOMA"]["tag"]="ES"; } if($_GET["action"]=="idioma" &&
$_GET["lang"]) { unset($_SESSION["IDIOMA"]);
switch($_GET["lang"]) { case "EN":
$_SESSION["IDIOMA"]["actual"]="EN";
$_SESSION["IDIOMA"]["abreviatura"]="_en";
$_SESSION["IDIOMA"]["nombre"]="Ingles";
$_SESSION["IDIOMA"]["tag"]="EN"; break; case "ES": default:
$_SESSION["IDIOMA"]["actual"]="ES";
$_SESSION["IDIOMA"]["abreviatura"]="";
$_SESSION["IDIOMA"]["nombre"]="Español";
$_SESSION["IDIOMA"]["tag"]="ES"; break;
} } $IDIOMA=array("actual"=>$_SESSION["IDIOMA"]["actual"],"ab"=>$_SESSION["IDIOMA"]["abreviatura"],"nombre"=>$_SESSION["IDIOMA"]["nombre"],"tag"=>$_SESSION["IDIOMA"]["tag"]);
global $wp_rewrite;
$wp_rewrite->set_permalink_structure($_SESSION["IDIOMA"]["tag"].'/%category%/%postname%');
return $IDIOMA; } add_action('init', 'detecta_idioma'); ?>
在路由条目上运行良好,例如www.mistiti.com/en/post-demo,t不使用页面或类别或分类法,例如:www.misite.com/es/category/、www.site.com/es/page/subpage或www.site.com/br/taxonomy此答案可以帮助您-我使用插件:高级自定义字段,自定义帖子类型UI和CMS树页面视图,当我激活插件时,您会向我指出以下错误:致命错误:调用/var/www/faytur redising/www/wp content/plugins/qtranslate slug with widget/qtranslate-slug-with-widget.php中未定义的函数qtranslate_parseURL(),第304Ah行,这就是为什么我把它作为评论而不是回答。你为什么不看看插件代码,看看它是如何处理的?它可能不会像魔术一样直接发挥作用,但它应该为您指出正确的方向,并帮助您扩大问题以寻求答案