WordPress 获取当前查询对象数据

WordPress获取当前查询对象

get_queried_object

Retrieve the currently-queried object. For example:

  • if you’re on a single post, it will return the post object
  • if you’re on a page, it will return the page object
  • if you’re on an archive page, it will return the post type object
  • if you’re on a category archive, it will return the category object
  • if you’re on an author archive, it will return the author object
  • etc.

写一条评论

发表评论

电子邮件地址不会被公开。 必填项已用*标注