WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 18 months ago

#36248 closed enhancement (wontfix)

Rename from `term_description` to `get_term_description`

Reported by: sebastian.pisula Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords: has-patch close dev-feedback
Focuses: template Cc:

Description

I think that name of function suggest that function display value.

Attachments (2)

36248.patch (1.9 KB) - added by sebastian.pisula 4 years ago.
362481.patch (2.9 KB) - added by sebastian.pisula 4 years ago.

Download all attachments as: .zip

Change History (8)

#1 @swissspidy
4 years ago

  • Component changed from General to Taxonomy
  • Focuses template added
  • Keywords close added

We can't simply rename a function due to backwards compatibility.

The only option would be a the_term_description() function, although I don't see a need for that.

#2 @sebastian.pisula
4 years ago

  • Keywords has-patch added; close removed

In my patch is in deprecated file:

<?php
function term_description( $term = 0, $taxonomy = 'post_tag' ) { 
        _deprecated_function( __FUNCTION__, '4.5', 'get_term_description()' ); 
                 
        return get_term_description( $term, $taxonomy ); 
} 

#3 @swissspidy
4 years ago

  • Keywords close added

With that patch we'd end up with two functions that do exactly the same, for no real reason.

One rule of thumb in WordPress core development is: Code refactoring should not be done just because we can.

See https://make.wordpress.org/core/2011/03/23/code-refactoring/ for more information.

#4 @SergeyBiryukov
4 years ago

We could probably add get_the_term_description() as an alias (there was a precedent in [27409]) and the_term_description() as a template tag, although I don't see a need for that either.

See the list of all the_* and get_the_* functions in comment:28:ticket:24164 for reference.

#5 @swissspidy
4 years ago

  • Keywords dev-feedback added

#6 @boonebgorges
18 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Closing based on the arguments above.

Note: See TracTickets for help on using tickets.