new Attachments(instance,post_id) fails
-
Hi,
Using latest version with wp3.5 to get attachments from post other than the current fails because:
global $post; if( is_null( $post_id ) && is_object( $post ) && isset( $post->ID ) ) { $post_id = $post->ID; } elseif( isset( $_GET['post'] ) ) { $post_id = intval( $_GET['post'] ); } else { // no post ID, nothing to do... return; }
If post_id is set then this logic causes get_attachments to return as though no post id was set.
Changed to
global $post; if( is_null( $post_id ) && is_object( $post ) && isset( $post->ID ) ) { $post_id = $post->ID; } elseif( isset( $_GET['post'] ) ) { $post_id = intval( $_GET['post'] ); } elseif (!isset($post_id)) { // no post ID, nothing to do... return; }
Works great (for me anyway, haven’t done extensive testing….!)
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘new Attachments(instance,post_id) fails’ is closed to new replies.