WordPress.org

Make WordPress Core

Opened 14 years ago

Closed 13 years ago

Last modified 13 years ago

#2763 closed defect (bug) (wontfix)

get_post_status should use post_status = inherit instead of post_type = attachment

Reported by: ryanscheuermann Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.1
Component: Administration Keywords: post_status attachment has-patch 2nd-opinion
Focuses: Cc:

Description

The function get_post_status gets the inherited post_status if the post_type = 'attachment', but shouldn't it test if post_status = 'inherit' instead? I'm attempting to allow attachments to be marked "private" regardless of their parent post/page's status. It's my assumption that by default, attachments have post_status = 'inherit', so changing this line shouldn't break anything.

get_post_status should be:

function get_post_status($ID = '') {
	$post = get_post($ID);

	if ( is_object($post) ) {
		if ( ('inherit' == $post->post_status) && $post->post_parent && ($post->ID != $post->post_parent) )
			return get_post_status($post->post_parent);
		else
			return $post->post_status;
	}

	return false;
}

Attachments (1)

patch-2763a.diff (605 bytes) - added by nelsonrp 14 years ago.
patch for wp-includes/post.php to handle post_status='inherit' and also treat post_status='publish' like 'inherit' if it has a parent page

Download all attachments as: .zip

Change History (7)

@nelsonrp
14 years ago

patch for wp-includes/post.php to handle post_status='inherit' and also treat post_status='publish' like 'inherit' if it has a parent page

#1 @nelsonrp
14 years ago

  • Keywords has-patch 2nd-opinion added

I changed it so that post_status='publish' is just like post_status='inherit' since it is highly unlikely that the child of a 'private' page/post should not be 'private' as well. Comments welcome.

#2 @matt
14 years ago

  • Milestone changed from 2.1 to 2.2

#3 @foolswisdom
14 years ago

  • Milestone changed from 2.2 to 2.3

#4 @Nazgul
13 years ago

  • Milestone changed from 2.3 to 2.4

#5 @thee17
13 years ago

  • Resolution set to wontfix
  • Status changed from new to closed

#6 @thee17
13 years ago

  • Milestone 2.5 deleted
Note: See TracTickets for help on using tickets.