How to query for posts with a null or blank post_name?

If you want to use WP_Query:

$no_title_posts = new WP_Query(array('name'=>'','posts_per_page'=>-1);

That will search all posts with empty name. The posts_per_page = “-1” returns all posts because by default wp returns 10 or whatever number you have selected in your admin settings.

if you want to retrieve it from other posts types (default is “post”), then you will need to specify it:

$no_title_pages = new WP_Query(array('name'=>'','posts_per_page'=>-1,'post_type'=>'page);

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)