Glowing Face Man
Member
Posted 4 weeks ago #
Hi,
It would be nice if we could turn off self-pingback. I'm constantly linking to my own articles. At least make it optional, controllable somewhere from wp-admin.
Yes, there's a plugin to stop self-pinging, but I looked at how the plugin works and it seems it doesn't actually remove the pingbacks, just hides them (assuming I read the php correctly), which is obviously pretty suboptimal performance-wise!
Thanks :)
-Glowing Face Man
I put this in my functions.php for the same effect:
<?php
/* No Frakin' Self Pings
*/
function no_self_ping( &$links ) {
$home = get_option( 'home' );
foreach ( $links as $l => $link )
if ( 0 === strpos( $link, $home ) )
unset($links[$l]);
}
add_action( 'pre_ping', 'no_self_ping' );
?>
Glowing Face Man
Member
Posted 4 weeks ago #
Thanks. Is add_action also a non-standard addition? I added that at the end of functions.php and got a PHP error that add_action was undefined.
-Glowing Face Man
No, add_action is default to WP.
http://codex.wordpress.org/Function_Reference/add_action
What else is in your functions.php? Do you mind sharing?
Glowing Face Man
Member
Posted 3 weeks ago #
I haven't touched my functions.php. It's standard Wordpress 2.8.5 (or whatever the latest release is).
Fatal error: Call to undefined function add_action() in /home4/glowingf/public_html/blog/wp-includes/functions.php on line 3350
Now I'm a little worried, if you're saying your snippet should work. Is something wrong with my intall..
-Glowing Face Man
Your functions.php is a theme file, not a 'standard wordpress' file :) I mean, it's standard but it's an optional file.
About the theme functions file
Remove the code from wp-includes/functions.php
Put it in a NEW functions.php file in your THEME.