londrum

msg:4339175 | 7:36 pm on Jul 13, 2011 (gmt 0) |
[edit: sorry, didnt read your post properly]
|
Sgt_Kickaxe

msg:4339176 | 7:39 pm on Jul 13, 2011 (gmt 0) |
P.S. I asked this in another forum and was bombarded with "why" and "don't do that" etc comments but nobody knew how. "It doesn't cause problems and it's on every wordpress site so don't worry about it" isn't helpful. The reason I need a solution: I'm implementing a shortening service and the 'shortlink' header element needs to point to the right place, it doesn't. I 'could' change how it works but REMOVING it is the solution I want/need. if you have any idea on how to remove the stinking 'Link:' element without a core change, thanks in advance.
|
londrum

msg:4339180 | 7:43 pm on Jul 13, 2011 (gmt 0) |
cant you just override it with your one, after it gets called? just put a function in your functions.php file which repeats the same header with your own value. i've never actually tried doing that, but it sounds like it should work okay. the whole page is assembled before output with wordpress, so you could even call it right at the end of the footer
|
Sgt_Kickaxe

msg:4339181 | 7:46 pm on Jul 13, 2011 (gmt 0) |
I can unset header elements via functions.php but this one won't unset.
|
londrum

msg:4339184 | 7:53 pm on Jul 13, 2011 (gmt 0) |
what about using the htaccess file to send the header. doesnt that override stuff sent from a .php file? im not sure how easy it would be for you to get it to send your own value though
|
Sgt_Kickaxe

msg:4339189 | 8:03 pm on Jul 13, 2011 (gmt 0) |
htaccess is not my strong suit. this works in functions.php by disabling the get_shortlink function. add_filter( 'get_shortlink', 'disable_stuff' ); function disable_stuff( $data ) { return false; } That's going to cause problems with some other plugins however and it's in other core files like edit-form-advanced.php so disabling the entire function is a bit overdone. JUST the header needs to be removed...
|
londrum

msg:4339200 | 8:18 pm on Jul 13, 2011 (gmt 0) |
you mentioned before that the headers get sent before the functions file is called. ...you can get around that by adding a new level of caching around the entire page. just add a new
ob_start(); to the very start of the header file
ob_end_flush(); to the very end of the footer file then you can use the original idea of overriding the header with your own one, which you can call right at the end of the footer before you flush it
|
lorax

msg:4339216 | 8:54 pm on Jul 13, 2011 (gmt 0) |
I would think that you should create a custom template of your own and in that template don't include the head element - write your own. Then go in the WP admin, and for the particular page you don't want the head element to be included on, simply set the template to the name of the custom template you created and loaded on the server. To learn more go here: [codex.wordpress.org...]
|
Sgt_Kickaxe

msg:4339228 | 9:28 pm on Jul 13, 2011 (gmt 0) |
It's not the <head> element i'm working on, it's the headers sent with the page, the host and status information etc. This is the relevant section of the wp_includes/link-template.php core file.
/** * Send a Link: rel=shortlink header if a shortlink is defined for the current page. * * Attached to the wp action. * * @since 3.0.0 * * @uses wp_get_shortlink() */ function wp_shortlink_header() { if ( headers_sent() ) return;
$shortlink = wp_get_shortlink(0, 'query');
if ( empty($shortlink) ) return;
header('Link: <' . $shortlink . '>; rel=shortlink', false); } everyone ends up with a header response that includes a NON pretty permalink url like... | Link: example.com/?p64682; rel=shortlink |
| Documentation for it can be found here (except nothing exists yet) - [codex.wordpress.org...]
|
lorax

msg:4339232 | 9:37 pm on Jul 13, 2011 (gmt 0) |
So even if you modify the custom template to include a header() function of your own, you're saying that headers have already been sent by that time.
|
Sgt_Kickaxe

msg:4339481 | 2:01 pm on Jul 14, 2011 (gmt 0) |
I'm saying that I can't unset the header value "Link" and I need to.
|
|