WordPress › Support » is-page-or-ancestor

Tag: is-page-or-ancestor Add New »

Is Page or Ancestor

This plugin is easy to use and very basic in its concept. It will recursively test if the page you pass into this function is the current page or ancestor of that page. You can pass either a page ID or page name and it will return true or false. For example, if I wanted to test that the current page I'm viewing is the About page or one of its ancestors, I would then use the following code to echo current_page_item if the function returns true.

  1. Frequently Asked Questions
  2. Developer Information
Topic Posts Last Poster Freshness
[Plugin: Is Page or Ancestor] $post->ancestors was always blank, so always returned false 1 James Revillini 4 years

Add New Topic

You must log in to post.