php – How to Send Pingbacks for all Posts in WordPress?


I deleted all my pingbacks and wanted to generate them again.

I found a some code on WordPress’s site, which showed the function pingback($Content, $ID)

It send pings to all links mentioned in content.

I tried to use it for of my 800 posts.

require_once( 'wp-config.php'); 
require_once( 'wp-load.php'); 


$Creations = get_posts( array('numberposts' => -1, 'post_type'=> array('post','download' )));
foreach ( $Creations as $Creation) { 
    $content = $Creation->post_content;
    $content = apply_filters('the_content', $content);
    pingback($content, $Creation->ID);

It works, but only for couple of posts. The code itself doesnt generate any errors…

But after pinging 6-7 posts it says error 500, presumably it took too long to execute.

As a result I can not send pings for my posts.

Suggest a better way, or help me improving this code to send pingbacks from all my posts.

Just so you know, I am using Bluhost Shared Hosting (not very powerful) and the formentioned code was in a file that I directly ran rather than hooking to init

Aditya Agarwal 1 year 2021-09-12T00:52:38-05:00 0 Answers 0 views 0

Leave an answer