I’m currently working on a plugin, and I essentially want to check if a certain page has been created.

Essentially, I want to do something like this:

    if (file_exists($file)) {
    $exists = true;
} else {
    $exists = false;
}

But I just want to do it so that it checks, instead, for a post_name value. (If I was further able to ensure that the post was a page and not just a post with that title, that would be great too.)

How do I do this?

I had been getting the script to grab the headers from the url of the post and if it returned a 404, to return $exists = false, but I’ve pinpointed a memory leak problem with that and I don’t think it’s very efficient.

Read more here: Checking for existence of a page by title?


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , ,

Wordpress related questions and answers: