One Quick Post
check if post title exists (1 post)

  1. dfvxvxcvcv komscvxc
    Posted 5 years ago #

    i added this lines to check if title exists.but something is not right.
    i'm using post id as permalinks but i don't want users to create many posts with the same title like:Avatar.

    // check if title $my_post_name already exists in wpdb
    global $wpdb;
    if($wpdb->get_row("SELECT post_title FROM wp_posts WHERE post_title = '" . $my_post_name . "'", 'ARRAY_A')) {
    echo $my_post_name.' already exists'; }


Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

  • RSS feed for this topic
  • Started 5 years ago by dfvxvxcvcv komscvxc
  • This topic is not resolved
  • WordPress version: 3.0.1