最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

rewrite rules - CPT - Nice url with add_rewrite_rule

programmeradmin4浏览0评论

I read lot of topick, but it don't work. And I really don't know what i do wrong ...

I put this code the the function.php of my child theme :

function capitaine_rewrite_url() {
    
    add_rewrite_tag( '%payment%','([^&]+)' );
    add_rewrite_tag( '%meals%','([^&]+)' );
    add_rewrite_tag( '%property-type%' ,'([^&]+)' );
    
    add_rewrite_rule(
      'properties/([^/]+)/([^/]+)/([^/]+)',
      'index.php?post_type=properties&payment=$matches[1]&meals=$matches[2]&property-type=$matches[3]',
      'top'
    );
}
add_action( 'init', 'capitaine_rewrite_url' );

I don't dorget to update /wp-admin/options-permalink.php"

Nothink change ...

With "Monkeman we can see "my" code go first before the standard

any idea what I'm forgetting?

thnaks for your help !

发布评论

评论列表(0)

  1. 暂无评论