[wp-trac] [WordPress Trac] #39850: Wordpress embedded links drop query vars from URL
WordPress Trac
noreply at wordpress.org
Sat Feb 11 23:09:05 UTC 2017
#39850: Wordpress embedded links drop query vars from URL
-------------------------+------------------------------
Reporter: charleslf | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Embeds | Version:
Severity: normal | Resolution:
Keywords: | Focuses:
-------------------------+------------------------------
Comment (by swissspidy):
Previous discussion on Slack about this:
https://wordpress.slack.com/archives/core/p1486845896008270
Passing the request URL to the `post_embed_url` filter would mean adding
it to the `get_post_embed_html()` function and all functions using it,
i.e. `print_embed_sharing_dialog()`, `get_oembed_response_data_rich()`,
`wp_filter_pre_oembed_result()`. At a quick glance, it seems doable, but
it would also make everything more complex.
My proposed (untested) workaround on Slack:
{{{#!php
add_filter( 'oembed_request_post_id', function( $post_id, $url ) {
if ( $url === … ) {
add_filter( 'post_embed_url', function( $embed_url ) use ( $url ) {
remove_filter( current_filter(), __FUNCTION__ );
// define $my_new_url based on $url
return $my_new_url;
} );
}
return $post_id;
}, 10, 2 );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39850#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list