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
- Determine if page is the Posts Page
- Keyboard shortcut for updating a page or post?
- Apply the_title() filter in post & page title, but not in menu title
- Difference between an archive and a page listing posts
- How to Display Network Post Count?
- How to display the page title/content in the Posts page?
- disable password protected page for logged users
- RSS for Pages Instead of Posts?
- how to enable different number of revisions for different blogs when using WPMU?
- Set number of article per number of page
- Should ‘setup_postdata()’ be reset with ‘wp_reset_postdata()’?
- Pull posts from another wordpress install on same server
- How can I get all posts data from within a paginated search result?
- Only display posts after current date
- Improving WP_Query for performance when random posts are ordered
- Private Posts/Pages & Search
- White Blank Page when Updating and Publishing Page/Post
- Posts vs. Pages
- Can’t get the_content of the parent page from its single post?
- Disable most recent & view all (TABS) on nav-menu.php
- Why content_arr[‘extended’] removes paragraph tags?
- WP_Query Authors OR Categories
- Add Word Limit to Posts
- How to insert 2 args into 1 Wp_Query for a slideshow
- Post categories to pages
- get query() without post content?
- Second comments section for one post/page
- Multi row post list
- posts_per_page option limits the number of Gallery items
- 404 error on default post type and default taxonomy fronted page
- How i can limit period of post publication?
- Dynamically switch template on click
- Get all custom post types excepted some…
- Get all comments of author’s posts
- Do not show children of a category
- How to detect when admin user is on the All Posts page?
- Query for first 3 posts to change the look and feel
- Custom Permalink Structure for Pages & Posts
- Getting a “404 Not Found” error when “Preview Changes” is clicked
- How to give classname to post if post has no content?
- New Posts and Pages Won’t Save
- My Custom Post Type Still Using index.php
- How to retrieve certain number of images from a wordpress post?
- 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)
- Changing wp_link_pages() to “Next Page” and “Previous Page” buttons?
- Page of posts made to look like homepage
- How to link post titles on page A to its posts on page B?
- Changing permalink of WordPress
- Indenting within a blockquote
- Create a List of Widgets, where each widget holds three attributes
- Change published date and time using SQL query for page in every 5 hour
- Is there a way to know when a page has been updated and do some action only once?
- Query to fetch custom taxonomy along with post title
- How to fetch courses in all languages in WordPress?
- WordPress Sticky Post Count “Fix” Breaking Pagecount by 72 pages!
- SQL query: select duplicate posts – but using duplicate meta [duplicate]
- Put page on Archived statut after end of publication date
- Multisite Issue on Subdomain’s article pages
- How to add a block to a category page?
- post and page and custom post type
- Show 5 posts and than 3 posts offset with pagination
- calling pages instead of posts
- WordPress display page information rather than post
- Post Category link is same with Page link
- Is it possible to query a category with specified posts?
- How do I set content in my pages so that it remains permanent while blog posts are added below?
- Permalink base only for posts
- Query posts from newest category
- WordPress URL question
- Query post by meta key of another table
- Theme does not respect spaces between paragraphs in pages
- Page and Posts loading as index page? Not loading the content
- My blog “page” used to show a list of posts, but now it’s just showing the page content?
- Ordering posts alphabetically by meta keys and title
- Why I have this strange behavior when I try to exlude the featured post from posts visualization?
- Grab next post title in archive page
- Continuous listing from a custom field
- How to store post rating system data post independent?
- get next/previous post name
- Get post title of faulty link on 404 error page
- Get current post’s child page?
- Get image paths from RSS feeds
- Limit amount of pages shown in pagination within wp_query
- how to show all type of author posts in author page (SOLVED)
- custom post type single page template not working
- WordPress Page Column Problem [closed]
- What function does the loop of displaying posts?
- Need to show birthday of custom post type(Famous people in this case) in elementor. Date of birth set in custom fields
- wordpress category Description not allowed tag
- Header and Footer options in pages and posts
- Blog posts are not appearing as subs of Blog Page
- Site ‘Categories’: save an admin global setting with post metadata [closed]
- Change permalinks in posts via SQL