WordPress.org

Make WordPress Core

Opened 4 months ago

Closed 4 months ago

#49225 closed defect (bug) (fixed)

Fix summary for shortcode_atts_{$shortcode}

Reported by: glebkema Owned by: SergeyBiryukov
Milestone: 5.4 Priority: normal
Severity: normal Version:
Component: Shortcodes Keywords:
Focuses: docs Cc:

Description

In the shortcode_atts() function the shortcode_atts_{$shortcode} filter is described as:

    /**
     * Filters a shortcode's default attributes.
     *

However, this filter does not affect the default values. Instead, it changes the output values of the attributes after they are combined with the default values:

     * @param array  $out       The output array of shortcode attributes.
     * @param array  $pairs     The supported attributes and their defaults.
     * @param array  $atts      The user defined shortcode attributes.
     * @param string $shortcode The shortcode name.
     */
    if ( $shortcode ) {
        $out = apply_filters( "shortcode_atts_{$shortcode}", $out, $pairs, $atts, $shortcode );
    }

I suggest to edit the filter summary, for example, like this:

    /**
     * Filters an array of shortcode attributes.
     *

Or even shorter:

    /**
     * Filters shortcode attributes.
     *

Change History (2)

#1 @SergeyBiryukov
4 months ago

  • Milestone changed from Awaiting Review to 5.4
  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

#2 @SergeyBiryukov
4 months ago

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

In 47087:

Docs: Correct description for shortcode_atts_{$shortcode} filter.

Props glebkema.
Fixes #49225.

Note: See TracTickets for help on using tickets.