Site icon Hip-Hop Website Design and Development

Disable Exterior Pingacks on WordPress Posts and Solely Enable ‘Self Pings’

I exploit wordpress for my Social Media website. WordPress Pings permit different weblog posts to look in feedback after they hyperlink to us.

I need to restrict it to solely weblog posts created by myself website. Principally I solely need SELF-PINGS/Trackbacks.

If Different website tries to ship ping reject it then and their, but when my very own website https://milyin.com’s publish tries to ship a ping readily settle for it and present it in remark part.

I attempted, wp-admin -> dialogue -> (unselect) Enable hyperlinks from different weblog posts.

However that disables inside Pings too.
Secondly My authors are in a position to activate/off the pingbacks for every publish. So, most of the posts nonetheless recieve exterior pings.

Here is a screenshot of the identical: https://snipboard.io/8lVIrE.jpg

I attempted to do some code.

I discovered a tutorial from How Disable Self Pingbacks in WordPress

And I attempted to change it to suit my wants

perform SelfPing( &$hyperlinks ) {
    $Dwelling = get_option( 'residence' );
    foreach ( $hyperlinks as $l => $hyperlink ){
        if ( strpos( $hyperlink, $residence )  === false){
            unset($hyperlinks[$l]);
        }
    }
}
add_action( 'pre_ping', 'SelfPing' );

Nonetheless this did not resolve the aim.

I nonetheless recieve pings from all kinds of web sites, on my posts, as majority of my authors manually activate Pings.

So How can I’ve solely self pings, and take away exterior pings, even when my authors manually activate pings for all posts.