Make WordPress Core

Opened 8 years ago

Last modified 7 weeks ago

#43791 new enhancement

Add the call to pingback_url to core instead of themes

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

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 8 years ago.
Add the call to pingback_url to core
43791_1.diff (1.2 KB ) - added by abdullahramzan 8 years ago.
Add the call to pingback_url to core (Patch refreshed)
43791_2.diff (1.2 KB ) - added by abdullahramzan 8 years ago.
Patch refreshed. Please discard the 43791_1.diff

Download all attachments as: .zip

Change History (12)

#1 @abdullahramzan
8 years ago

  • Keywords has-patch needs-testing added
  • Version4.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
8 years ago

Add the call to pingback_url to core

#2 @joyously
8 years ago

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

#3 @abdullahramzan
8 years ago

Hello @dshanske,

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

Thanks

#4 @dshanske
8 years 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
8 years 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
8 years ago

Add the call to pingback_url to core (Patch refreshed)

@abdullahramzan
8 years ago

Patch refreshed. Please discard the 43791_1.diff

#6 @abdullahramzan
8 years ago

  • Keywords needs-refresh removed

This ticket was mentioned in Slack in #core by joyously. View the logs.


6 years ago

#8 @huzaifaalmesbah
6 months ago

  • Keywords needs-refresh added; needs-testing removed

I attempted to apply the patch (43791_2.diff) against current trunk (7.0-alpha).

Patch results:

  • wp-includes/default-filters.php → hunk failed (.rej created)
  • wp-includes/general-template.php → hunk failed (.rej created)

The patch does not apply cleanly, so testing is not currently possible.

Since the patch can’t be applied, keeping needs-testing is not meaningful at this stage. The patch should be refreshed to match current trunk first.

Removing needs-testing and adding needs-refresh. Testing can continue once an updated patch is available.

This ticket was mentioned in PR #12294 on WordPress/wordpress-develop by @sukhendu2002.


7 weeks ago
#9

  • Keywords has-unit-tests added; needs-refresh removed
Note: See TracTickets for help on using tickets.