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

plugin development - Show content without a post

programmeradmin2浏览0评论

I am writing a plugin, and want to show an about page, but without a post/page record. So if, the url is entered, my 'hardcoded' content is shown.

A bit like the login page, there is no login post, but the login screen displays.

Which hooks would I need to use to catch the url, and then output my content without getting a 404?

I am writing a plugin, and want to show an about page, but without a post/page record. So if, the url https://example/about is entered, my 'hardcoded' content is shown.

A bit like the login page, there is no login post, but the login screen displays.

Which hooks would I need to use to catch the url, and then output my content without getting a 404?

Share Improve this question asked Oct 2, 2020 at 17:29 StripyTigerStripyTiger 2771 silver badge6 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

you can try 'request' hook:

add_filter('request', function( $vars ) {

    $request = urldecode($_SERVER['REQUEST_URI']);
    if ( stristr($request, '/YOUR_SLUG') != false ) {
        ...
    }
}
发布评论

评论列表(0)

  1. 暂无评论