Make WordPress Core

Opened 11 years ago

Closed 10 years ago

#34480 closed enhancement (duplicate)

get_the_content inconsistent with get_the_title

Reported by: atomicjack Owned by:
Priority: normal Milestone:
Component: Posts, Post Types Version: 4.4
Severity: normal Keywords: has-patch 2nd-opinion
Cc: Focuses: template

Description

get_the_title accepts a post id parameter, to target a specific post outside of the loop; one would assume that get_the_content would work the same way.

That is not the case.

get_the_content does not currently accept a post id as the first parameter - which goes against what would be assumed after having used get_the_title.

TLDR: add post id parameter to get_the_content.

Attachments (2)

34480.diff (1.5 KB ) - added by MikeHansenMe 11 years ago.
34480-2.diff (1.5 KB ) - added by MikeHansenMe 11 years ago.
use $post instead of $id

Download all attachments as: .zip

Change History (7)

#1 @SergeyBiryukov
11 years ago

  • Component GeneralPosts, Post Types
  • Focuses template added

#2 @swissspidy
11 years ago

Note: get_the_excerpt() doesn't support a post parameter either. It has a deprecated function argument though.

@MikeHansenMe
11 years ago

#3 @MikeHansenMe
11 years ago

  • Keywords has-patch 2nd-opinion added

34480.diff add the additional id param to both get_the_content and get_the_excerpt. It is a bit strange that they are in different positions (second and third) and after deprecated params but the use case seems to make sense.

#4 @knutsp
11 years ago

Param name should be $post, not $id, I beleive. See #34234.

@MikeHansenMe
11 years ago

use $post instead of $id

#5 @ocean90
10 years ago

  • Milestone Awaiting Review
  • Resolutionduplicate
  • Status newclosed

get_the_excerpt() was fixed in [36319].

get_the_content() is a duplicate #11890.

Note: See TracTickets for help on using tickets.