Add code

Posted in: Newspaper
Post count: 19

I want to add this code to a theme:

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' );

where should I add it?
can I add it in custom code? and do I add it to Javascript part?

Post count: 35449

Hi,

This is not just a simple code, I think that will be better to set this code in functions.php and would be preferable to set it in a child theme, in this way you’ll not lose the code when you’ll make a theme update ( also make sure hat you have the last version of the theme, v9.7.4).
Child theme support https://forum.tagdiv.com/the-child-theme-support-tutorial/

Hope this will help you!
Thank you!

Post count: 19

Can I use the plugin to make a child theme or I need to do it by following all these steps that you gave me?

Post count: 35449

Hi,

Only the child theme provide by us in the theme package that you currently have is indicate to use, other plugins will not work.
Child theme support – https://forum.tagdiv.com/the-child-theme-support-tutorial/

Thank you!

Viewing 4 posts - 1 through 4 (of 4 total)
The forum ‘Newspaper’ is closed to new topics and replies.