[wp-trac] [WordPress Trac] #63534: Add `link_to` label to post types
WordPress Trac
noreply at wordpress.org
Thu Jun 5 17:06:32 UTC 2025
#63534: Add `link_to` label to post types
-------------------------------------------------+-------------------------
Reporter: benoitchantre | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting
| Review
Component: Posts, Post Types | Version:
Severity: normal | Resolution:
Keywords: good-first-bug has-patch needs- | Focuses: ui
test-info |
-------------------------------------------------+-------------------------
Changes (by SirLouen):
* keywords: good-first-bug has-patch => good-first-bug has-patch needs-
test-info
Comment:
@benoitchantre can you explain how this can be displayed or tested?
@ravigadhiyawp commented this during our patch testing session, the thing
is after the patch I can't see anything changing with this patch (I was
expecting the post/page not capitalized). I wondered if a newer version of
Gutenberg is required for this to display or something.
For example after applying the patch, the Page is still capitalized:
[[Image(https://i.imgur.com/3cLdRPa.png)]]
Replying to [comment:3 riccardodicurti]:
> Ciao, while reviewing this change, I noticed the array formatting is
inconsistent (some entries inline, others multiline).
>
> Is it generally acceptable to update the formatting for consistency when
touching these arrays, or is it better to leave existing style unchanged
unless it's directly related to the fix?
>
> Just want to align with best practices.
Generally you should pass the PHPCS. If the line is going to be too long
with a single line, you have to move into multiline. You can go multiline
if you wish. There is no real rule of thumb other than being PHPCS
compliant.
Here as I run the PHPCS checker script:
{{{
$ vendor/bin/phpcs src/wp-includes/class-wp-post-type.php
. 1 / 1 (100%)
}}}
No issues are found. A different thing will be if they use the short form
of array like this:
{{{
'link_to_item' => [
_x( 'Link to post', 'editor control label' ),
_x( 'Link to page', 'editor control label' ),
],
}}}
Then it will throw the PHPCS error, which is unnaccepted
{{{
FILE: src/wp-includes/class-wp-post-type.php
--------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------
1029 | ERROR | [x] Short array syntax is not allowed
(Universal.Arrays.DisallowShortArraySyntax.Found)
--------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63534#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list