WordPress.org

Make WordPress Core

Opened 2 months ago

Last modified 2 months ago

#43791 new enhancement

Add the call to pingback_url to core instead of themes

Reported by: joyously Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.9.5
Component: Pings/Trackbacks Keywords: has-patch needs-testing 2nd-opinion
Focuses: Cc:

Description

The <head> section contains a lot of <link> items that WordPress core generates.

Why should themes be responsible for outputting the pingback_url() <link>?

The core code should remove this burden from the theme and ensure that it is handled every time and correctly. Currently, the theme needs code like this:

function mytheme_pingback_header() {
	if ( is_singular() && pings_open() ) {
		echo '<link rel="pingback" href="', esc_url( get_bloginfo( 'pingback_url' ) ), '">';
	}
}
add_action( 'wp_head', 'mytheme_pingback_header' );

and a lot of themes don't even have it, so then there are core options that don't work correctly. This logic belongs in core.

Attachments (3)

43791.diff (1.2 KB) - added by abdullahramzan 2 months ago.
Add the call to pingback_url to core
43791_1.diff (1.2 KB) - added by abdullahramzan 2 months ago.
Add the call to pingback_url to core (Patch refreshed)
43791_2.diff (1.2 KB) - added by abdullahramzan 2 months ago.
Patch refreshed. Please discard the 43791_1.diff

Download all attachments as: .zip

Change History (9)

#1 @abdullahramzan
2 months ago

  • Keywords has-patch needs-testing added
  • Version set to 4.9.5

Hello @joyously ,

Yeah it should be the part of the core. I have also created a patch (43791.diff) for this enhancement. Must test the patch.

Thanks

@abdullahramzan
2 months ago

Add the call to pingback_url to core

#2 @joyously
2 months ago

That's good, but what to do about themes that are already doing this?

#3 @abdullahramzan
2 months ago

Hello @dshanske,

Can you please share your views about this ticket so I can update patch accordingly.

Thanks

#4 @dshanske
2 months ago

  • Keywords 2nd-opinion needs-refresh added

It should be get_bloginfo( 'pingback_url' ), not site_url( '/xmlrpc.php' ). That adds the ability to filter the pingback url and redirect it elsewhere. You could, if anyone ever wrote one, delegate pingback handling to a service.

I'm in favor of Core handling this. It never should have been theme territory and your points are all valid. However, this was rejected before my tenure in #10094, so I'm not sure if it would get through now. I think we need to get more consensus on whether this would be even considered for a commit.

#5 @abdullahramzan
2 months ago

Hello @dshanske ,

Thanks for your feedback on this ticket. Yeah definitely it should be core territory.

It should be get_bloginfo( 'pingback_url' ), not site_url( '/xmlrpc.php' ).

I also refreshed the patch.

Thanks

@abdullahramzan
2 months ago

Add the call to pingback_url to core (Patch refreshed)

@abdullahramzan
2 months ago

Patch refreshed. Please discard the 43791_1.diff

#6 @abdullahramzan
2 months ago

  • Keywords needs-refresh removed
Note: See TracTickets for help on using tickets.