WordPress.org

Make WordPress Core

Opened 14 months ago

Closed 8 months ago

#45179 closed defect (bug) (fixed)

Improve documentation for postbox_classes() and the postbox_classes_{$page}_{$id} hook within it

Reported by: DrewAPicture Owned by: sharifkiberu
Milestone: 5.2 Priority: normal
Severity: normal Version: 3.2
Component: Posts, Post Types Keywords: good-first-bug has-patch needs-refresh
Focuses: docs Cc:
PR Number:

Description

As pointed out on the Code Reference by @simonrcodrington, documentation for the $page and $id values in the postbox_classes_{$page}_{$id} hook is not quite correct.

$page actually represents the screen ID and $id represents the metabox ID. We should also improve the DocBlock for the postbox_classes() parent function by adding missing parameter descriptions.

<?php
/**
 * Filters the postbox classes for a specific screen and screen ID combo.
 *
 * The dynamic portions of the hook name, `$page` and `$id`, refer to
 * the screen and screen ID, respectively.
 *
 * @since 3.2.0
 *
 * @param string[] $classes An array of postbox classes.
 */
$classes = apply_filters( "postbox_classes_{$page}_{$id}", $classes );

Attachments (1)

45179.diff (439 bytes) - added by sharifkiberu 13 months ago.

Download all attachments as: .zip

Change History (6)

#1 @DrewAPicture
14 months ago

  • Milestone changed from Awaiting Review to Future Release

@sharifkiberu
13 months ago

#2 @sharifkiberu
13 months ago

  • Keywords has-patch added

@DrewAPicture Updated documentation in patch

#3 @DrewAPicture
13 months ago

  • Milestone changed from Future Release to 5.1
  • Owner set to sharifkiberu
  • Status changed from new to assigned

Assigning the ticket to mark the good-first-bug as "claimed".

Hi @sharifkiberu, thanks for the patch! I think we still need adjustments to the postbox_classes() adding missing parameter descriptions and that should do it.

Trunk development is still closed pending the 5.0 release, but we should be able to get this in with 5.1.

#4 @pento
11 months ago

  • Keywords needs-refresh added
  • Milestone changed from 5.1 to 5.2

#5 @SergeyBiryukov
8 months ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 45083:

Docs: Improve documentation for postbox_classes().

Rename $page and $id variables to $screen_id and $box_id for clarity.

Props sharifkiberu, DrewAPicture.
Fixes #45179.

Note: See TracTickets for help on using tickets.