The publish_page action is listed as deprecated.
You can use the ‘transition_post_status’ hook to check if a page was published.
function publish_page_interception( $new_status, $old_status, $post ) {
if ( ($new_status != $old_status) && ($post->post_status == 'publish') && ($post->post_type == 'page') ) {
if($post->post_parent > 0) {
//do stuff
}
}
}
add_action( 'transition_post_status', 'publish_page_interception', 10, 3 );
Look here for further info:
http://codex.wordpress.org/Post_Status_Transitions
Happy Coding,
Kuchenundkakao
Related Posts:
- Check if is on child-page of a particular page
- A check for if is parent page, if has children, if has grandchildren
- Can I have two child pages of different parents with the same name?
- Create a “Dummy” parent page for a hierarchy in page listing?
- Allow only new sub-pages to be created
- Is there a default template file for child pages / subpages?
- Get Permalink for the top level parent of child pages
- Some pages are missing from the Parent Page select in the Editor
- How to display list of child pages of parent page in wordpress?
- Only allow new subpages to be created
- Can’t change parent page
- Show child pages when on a child page
- select a private page as parent for another private page
- Can I set a timer for pages to be published?
- WordPress pages with hierarchy
- load common thank you template with different content for different pages
- Problem With Pages Displaying
- remove/hide pages from users backend
- List child pages by slug not ID?
- Redirect to page list when page published
- get_pages() & “child_of”
- Combining ‘depth’ with ‘include’ in wp_list_pages()
- Removing Parent Page URL While Keeping the Navigation Intact
- Organizing Your Pages
- Custom page template for multiple pages
- Can a user find a child page?
- Display child pages in sidebar of parent page in wordpress
- Display child pages in a parent page? [closed]
- Redirect page to default subpage
- How to list a page tree?
- List all posts with the parent or grandparent of a page with a specified ID
- Page access only from a specific page in wordpress website
- Keep page hierarchy in wp_list_pages, even if on a child or grandchild
- Publish page by invoking submit via jQuery
- Listing all child-pages of a parent-page on the parent-page and each child-page?
- How to control display of page lists on sidebar that doesn’t have childrens
- way to make all pages with certain tags public?
- Check if page has subpages
- Exclude child pages args array
- Search anything from a Child and Sub-Pages of their Parent page
- How to get an array of pages ID by some page’s slug and all its children pages in get_posts() function?
- Return true if parent page id matches
- If page or sub page not working as expected
- Front Page post mirroring revisions to other pages, constantly updating itself
- How to use wp_dropdown_pages or wp_list_pages to accomplish a menu like this?
- Display grandchild page content on parent page
- Display inner pages like posts.[Like how post excerpt works]
- How to show the view more on my display of pages shortcode
- Childpage title + content on Parent Page
- My page won’t publish
- How to copy specific page content and create child page?
- Pages redirecting to homepage
- How to finish this loop?
- displaying child pages in columns when on a parent page
- How to make in post Parent page children page list nummbered
- Woocommerce – Making product pages child of shop
- Default pages to be unpublished – possible?
- List of pages – AJAX load more
- Output the published date / last modified date of specific page
- Set Session Time Limit for Password Protected Posts
- Dynamic content in a static page
- Static files or dynamic WP pages for “static content”?
- Child page from 2 different parent pages
- Redirect “Sorry, you are not allowed to access this page.” to Home
- Add a Menu Link (to a WordPress Page) in the Admin Menu/Sidebar
- Too Many Pages in WordPress? 2013
- How can I automatically add child pages to pages in a WP menu?
- Job Manager plugin help?
- How to make tag post listing page working?
- Admin pages, edit notes of the title of posts and pages
- Special Character Appearing in my WordPress Pages Content
- WordPress pages creation work distribution & then combining – Localhost XAMPP
- Prioritize visible content – Page speed issue on Google insights
- How can I check user capability when a page loads (via functions.php)?
- Bad pages redirection
- Remove_filter (‘the_content’, ‘wpautop’) only pages
- Weebly Migration to WordPress [closed]
- Need to create a custom page on a website
- How To Render Shortcode In AJAX Response?
- Do I have to widgetize my pages?
- Password Protect Pages Not Working
- Can I connect a page to a taxonomy?
- parent page grabbing wrong url for child pages – get_page_uri($pageChild)
- wp_nav_menu: output featured image of each page listing
- Change displayed “page name” to distinguish multiple pages with the same title
- add title to widgets of wordpress
- Custom user tables not working after migration
- How to transfer a site to hosting?
- How can a .css file be applied to a virtual page?
- WordPress blog posts template bug [closed]
- Checkboxes to automatically create pages when I activate a theme
- Cannot use old slug – it just 301s to site home page
- How to sort a sub-menu, generated with get_pages(), by the page order instead of alphabetically?
- include exception inside theme for empty widget area
- My pages disappeared from the list
- How to display time when page is created and edited
- different single.php for different page templates
- Passing variables through a href link from one page to another page
- Parent – Child Pages and Templating in wordpress
- How to remove container box in WordPress pages? [closed]