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

plugins - Alter post slug by a filter that is fired just after a post is created

programmeradmin0浏览0评论

)

I found (for example in Set default (auto) slug prefix for Tags) that it is possible for example add my-taxonomy prefix in front of all taxonomy slugs (permalinks). The post is outdated now since such prefix can be now specified in WP settings.

What can't be done in settings it to specify slug prefix (=> modify slug) for a specific/custom post type. There are some plugins that can do that but they usually do a lot of things and I'd prefer to write a couple of lines of code that I can add to functions.php/custom plugin/mu-plugin...

In other words I'm trying to write PHP that gets fired just after a post (with defined type) is created and that alters slug from my-new-post to my-prefix/my-new-post.

I spent two days of googling / testing but I haven't been able to make it work. At least not for post_type attachment.

Could you please help me with that?

Thank you.

Best regards,

Mat

发布评论

评论列表(0)

  1. 暂无评论