Check WordPress Content Exists or Not Before Post
June 19, 2022 ⚊ 1 Min read ⚊ WORDPRESSAre you want to post from front-end of the WordPress website?
You can check whether your content already exists in the database or not using the below code. It will prevent your website from duplicating content.
<?php
$content = $_REQUEST['frm_content'];
if ( ! function_exists( 'post_exists' ) ) {
require_once( ABSPATH . 'wp-admin/includes/post.php' );
}
$found_post_content = post_exists( '',$content,'','', '');
if ($found_post_content){
echo "Content Exists");
}
else {
echo "Content Not Exists");
}
?>