How to search CPTs in draft using get_page_by_title()

I’m aware that get_page_by_title() is not an option when you want to look for posts (or CPTs in my case) that are not published (i.e. in draft).

Some of the solutions that I’ve found are based on SQL queries, but they are old examples (more than 5 years old), and I’m afraid that they are not recommended according to the best practices on SQL queries using the wpdb class.

So… how to get it?

Maybe there’s a filter or hook for the get_by_page_title() function?
Perhaps the best way to achieve it is writing a custom SQL query? And how?
What do you think?

Read more here:: How to search CPTs in draft using get_page_by_title()

Leave a Reply

Your email address will not be published. Required fields are marked *