Don’t know if it’s best practice but i had a similar issue and I ended up checking by custom sql query to check if the title already exists in my post type
and filtered duplicate posts and i hooked that to wp_insert_post_data filter hook.
add_filter('wp_insert_post_data','prevente_duplicates');
function prevente_duplicates($data,$postarr){
$count = $wpdb->get_results($wpdb->prepare("SELECT count(id)
FROM $wpdb->posts
WHERE post_type="MY_POST_TYPE_NAME"
AND post_title="%s"",$data['post_title']));
if ($count > 0 ){
return false;
}
return $data;
}
Related Posts:
- How does nonce verification work?
- How to expire a nonce?
- Fatal error: Call to undefined function wp_create_nonce()
- How to add/retrieve the post trash link?
- Using nonce external of WP Admin
- Nonce best practices: hidden input vs. wp_localize_script?
- “The link you followed has expired” when previewing a post
- wp_verify_nonce keeps failing
- Handling nonce generation in AJAX registration process
- increase nonce lifespan
- wp_verify_nonce() via REST always returns false
- Nonce failing in IE
- my theme breaks WP export
- Why am I getting a 403 from check_admin_referer()?
- x-wp-nonce across domains
- wp_create_nonce doesn’t verify when using WP_List_Table
- Handling expired nonces
- What is really “wp_nonce_field” and how does it work? [duplicate]
- Cannot verify nonce
- wp_verify_nonce return false despite correct parameter passed
- WordPress JSON API nonces and Vue development server
- Verify a nonce in Form submission
- phpcs error in WordPress
- Stop WordPress nonces expiring
- Several nonces?
- Nonce for Trashing Item
- Nonce keeps failing
- How to obtain “wp_rest” nonce for WP Statistics plugin manually?
- WordPress “nonce” message
- CSP nonces with Cloudflare Workers
- Why are nonces working in Firefox but not in Chrome?
- wp_verfy_nonce keeps giving false
- Nonce – reissue with ajax poll
- wp_nonce_url generating invalid links
- How to insert wp_nonce field within echoed string
- Nonce check causing issues when creating new post
- Weird nonce validation problem
- Logout button in menu without “wp” in links
- Check nonce in the new bulk_edit_posts action
- Do I need a nonce field for every meta box I add to my custom post type admin?
- Can I use the same nonce for multiple requests on the same page?
- How to get a unique nonce for each Ajax request?
- Nonce retrieved from the REST API is invalid and different from nonce generated in wp_localize_script
- How to use nonce with front end submission form?
- Nonces and Cache
- AJAX nonce with check_ajax_referer()
- Verify nonce in REST API?
- What is nonce and how to use it with Ajax in WordPress? [duplicate]
- Getting “The link you followed has expired” when adding custom post [closed]
- Handling nonces for actions from guests to logged-in users
- How to add WordPress nonces to ajax request
- Can I verify nonce which was generated on a different WP site?
- Headless WordPress: How to authenticate front end requests?
- Nonces and Ajax request to REST API and verification
- How to stop _wpnonce and _wp_http_referer from appearing in URL
- WP REST API: check if user is logged in
- wp_verify_nonce doesn’t return true on server when it matches the nonce
- Rest API invalid nonce with Backbone Client
- Verify Nonce returns false – Request Nonce returns correct value
- wp-admin AJAX with Fetch API is done without user
- Nonce generated 0-12 hours ago
- permission_callback has no effect
- WP REST API – Nonce passes wp_verify_nonce even after logout
- Maximum lifetime for nonce
- Use of check_admin_referer with theme options and options.php
- Passing nonce at admin menu link
- “The link you followed has expired” & “Error while saving” messages when adding new post
- SSO autologin WordPress + Ajax
- Is nonce in PHP form and Ajax both necessary?
- Nonce fails on ajax save
- Form Security: nonce vs. jQuery
- wp_nonce_field displaying twice
- Is it safe to use a global wp nonce per user instead of a nonce per action?
- Rest API: wp_verify_nonce() fails despite receiving correct nonce value
- Nonce doesn’t validate in nopriv call
- Should I use wp_nonce_field on my contact form?
- Why does check_ajax_referer give a 403 error on https websites?
- WordPress is creating nonce as a logged in user but verifying it incorrectly
- Backbone with custom rest endpoints
- Restrict Access without Creating Users
- How to use nonce
- Where to use nonce
- Re-use Nonce in Repeating Event Signup Buttons
- How to add a WordPress Nonce for this form to avoid CSRF
- Saving custom data via ajax with nonces
- Reliable way to add nonce to HTTP Header in WordPress?
- Log out without confirmation request (nonce)
- wp_nonce vs jwt
- Using a nonce Content Security Policy header for style-src for inline style elements returns errors
- wp_verify_nonce not working on the mobile device
- How to not cache nonces with WP Rocket?
- whether a nonce is required for get type and get_query_var?
- Unable to update plugins or log out
- Does it make sense to check a nonce on user log in?
- Override plugin function to show invoices even if not logged in
- CSRF attack to create USER
- Is it necessary to use a WordPress nonce when allowing users to download public data?
- Wp doesn’t save meta box data
- Is there a solution to expired nonces in forms when using full page caching that doesn’t involve configuring the cache?
- Nonce code vulnerability