Problem with some page when have the same name as an attachment
-
Hi,
I found a bug that when I have a page that its name is the same has an attachment instead of loading the page it load the attachment. I think I found the solution, I have changed 2 lines and now it works:line 1171:
$pages = $wpdb->get_results( "SELECT $wpdb->posts.ID, $wpdb->posts.post_parent, $wpdb->postmeta.meta_value FROM $wpdb->posts,$wpdb->postmeta WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id AND $wpdb->postmeta.meta_key = '$meta_key' AND $wpdb->postmeta.meta_value IN ($in_string) AND ($wpdb->posts.post_type = '$post_type_sql' OR $wpdb->posts.post_type = 'attachment')", OBJECT_K );
I have removed the OR $wpdb->posts.post_type = ‘attachment’
line 1202:
$page_id = $wpdb->get_var( "SELECT ID FROM $wpdb->posts WHERE post_name = '$last_part' AND (post_type = '$post_type_sql' OR post_type = 'attachment')" );
I have removed the OR post_type = ‘attachment’
Tell me if it’s a good solution or if you have a better one. Also let us know in changelog if in next version it has been solved otherwise I would update my modified plugin.
Thanks for your atention!
- The topic ‘Problem with some page when have the same name as an attachment’ is closed to new replies.