you can use the same function simply hook it to the publish_page
hook
or any custom post type for that matter publish_{post type name}
so just add :
add_action('publish_page', 'clearDuplicatePosts');
Related Posts:
- Query posts from different categories in multisite
- Change Author Name to Sitename on Frontend
- Google indexing duplicate page content with Page #### in post title and /page-2 in permalink instead of the ones I set
- Count posts for pagination
- The page that displays Posts on homepage
- Start post pagination at 0 instead of 1
- Hooking into the post editing screen for an existing page only
- How to setup a query to output posts by groups of five?
- How do I do a page break?
- Is there a way to specify an extra class for a post or page with no title?
- Automatically create a new page daily with last three posts
- Using wp_list_pages() after calling query_posts()
- When changing pages to posts, how do you set up 301 redirects for the page URLs?
- Display Posts on Custom Page
- Exclude current custom post on single post
- User Selectable Delete of Pages
- 2 dynamic sidebars registered, not showing up
- Dynamically switch template on click
- How to get posts and comments amount per hour, per year and per month?
- Multiple Loops Breaking Pages
- Get all custom post types excepted some…
- “about us”, ” contact” sections should be article(post) or page in the simple small Business website?
- How to get ID of the page included with get_page()?
- Posts vs Pages and categories
- Get all comments of author’s posts
- How to dynamically parse and transform post/page content before displaying it?
- How to WP_Query() from multiple blogs and order them?
- First x post with another template then the others
- Why Query is returning empty array?
- How to make default “Privacy Policy Page” a normal page?
- Delete all drafts?
- disable Tab post on nav-menus page (Admin)
- Wrap every month posts in div
- Proper way of establishing custom landing pages in WordPress
- Is it possible to filter the main loop to exclude posts from a specific category?
- Inner join overrides Advanced Custom Fields plugin’s get_field [closed]
- meta_value timestamp older than now
- Counter is skipping post when I still want it visible [closed]
- is_page Funtion for Posts ?
- Do not show children of a category
- is_page() and is_page_template() not being differentiated
- post__in not working with pre_get_posts, but post__not_in does work
- Admin – no Featured image choice in create new/page|post
- How to detect when admin user is on the All Posts page?
- Can’t get full post title if there a spaces in title
- How to get all post_parents of a post?
- static landing page leading to author specific pages w/ “live” content
- How do I show posts from another wordpress installation?
- Query for first 3 posts to change the look and feel
- Why posts array is empty?
- Total number of posts in query (category/tag/author/search results/main page…)
- Custom Permalink Structure for Pages & Posts
- Getting a “404 Not Found” error when “Preview Changes” is clicked
- Display password protected posts to logged in users
- Why won’t pagination work?
- Query posts and filter at query time by value of custom meta
- Run query_posts if SESSION is empty?
- WordPress Query Posts From Category Post on Static Page
- How to create a “latest news” page showing a list of posts from blog category
- How do you search for a post or page with a certain url on the WordPress admin panel?
- Very complex post query
- How to add some html formated text to every new post in WordPress
- Delete post revisions only for a single post
- Intercept page request and add value to it
- How to give classname to post if post has no content?
- Display post by click on the link
- WordPress 302 Redirect to Random Product/Post/Page
- Output Post with ACF Fields into other Post
- How to create a page that shows the last 10 posts?
- $_GET parametters not working in an specific template
- Queries take 120+ seconds on my large WordPress site
- Exclude some posts from displaying in wp_query based on some condition
- New Posts and Pages Won’t Save
- My Custom Post Type Still Using index.php
- get_children returns older images
- Posts and Pages: 404 Page not found
- Related Posts function not working
- How to retrieve certain number of images from a wordpress post?
- the_content() Not Grabbing All Content
- Display Featured Posts Grid on Static Page (Gazette)
- Detecting current page from class method
- Having pages after specifying post_type post
- Unabled to Change Permalinks – Even Using the “Edit” (Resets to Original Permalink on “Update”)
- List all posts, pages and custom post types in admin
- How to convert query sql to shortcode in wordpress?
- WordPress loop not working on static front page
- Make ‘blog’ page show content as well as posts underneath it
- I don’t want the complete article to show on homepage
- Post/page title to permalink transformation – what is behind the scenes?
- Would a “hub” page work better as a page or a post?
- Some doubts about how the loop work (trying debugging it)
- Display on page every post in blog WITH comments
- Are post, page and category IDs unique to each other?
- Showing recent post of category in page
- HTML Inside of Shortcode Breaks Shortcode Output
- Setting limit to posts or page creation
- Cannot select certain authors for posts after import
- How to display only one category in a custom post type?
- Create a frontpage.php and static page template
- Using Posts Like a Page