All Wordpress users who know how to implement the Ping function in WordPress know that by configuring the WordPress Ping service list, you can immediately notify the search engine spider to capture a new article when you publish it, the first time you update the subscribed channel (feed ).
Therefore, add the Google Ping address to the WordPress Ping service list, and then use the articles published by the Wordpress blog to quickly appear in the Google database.
Here we will analyze how the WordPress Ping function is implemented.
To analyze the Ping function, you must first understand the following:
1. the location where the WordPress Ping service list is stored in the database is:
Copy content to clipboard
Code:
// Wp_options table
SELECT * FROM wp_options WHERE option_name='ping_sites'
2. WordPress provides trackback and Ping functions.
Since the contact with WP is not long and you are not familiar with many of the functions, you can only find the ping service code in the wp_shortdes/comment. php file for the time being:
You can find the following functions in this file:
Function do_all_pings ()
Function pingback ($ content, $ post_id)
Function weblog_ping ($ Server = '', $ Path = '')
I think the most important function is weblog_ping.
The Code is as follows:
Copy content to clipboard
Code:
function weblog_ping($server = '', $path = '') {
global $wp_version;
include_once(ABSPATH . WPINC . '/class-IXR.php');
// using a timeout of 3 seconds should be enough to cover slow servers
$client = new IXR_Client($server, ((!strlen(trim($path)) || ('/' == $path)) ? false : $path));
$client->timeout = 3;
$client->useragent .= ' -- WordPress/'.$wp_version;
// when set to true, this outputs debug messages by itself
$client->debug = false;
$home = trailingslashit( get_option('home') );
if ( !$client->query('weblogUpdates.extendedPing',
get_option('blogname'), $home, get_bloginfo('rss2_url') ) ) // then try a
normal ping
$client->query('weblogUpdates.ping', get_option('blogname'), $home);
}
Among them, weblogupdates. extendedping is consistent with the situation described in Google's "blog search" help:
Reference:
About Google "blog search" Ping service application programming interface (API)
Requests from XML-RPC customers should contain the following elements:
RPC endpoint:
Http://blogsearch.google.com/ping/RPC2
Call Method Name:
Weblogupdates. extendedping
Parameters:
(Transmitted in the same sequence as listed below)
The XML-RPC response returns the <struct> with two elements:
- Flerror (Boolean): Set to true/1 when an error occurs.
- Message (string): "Thanks for the ping." (if successful) or an error message (if not ).
Common XML-RPC Ping services
http://rpc.pingomatic.com
http://rpc.twingly.com
http://api.feedster.com/ping
http://api.moreover.com/RPC2
http://api.moreover.com/ping
http://api.my.yahoo.com/RPC2
http://api.my.yahoo.com/rss/ping
http://www.blogdigger.com/RPC2
http://www.blogshares.com/rpc.php
http://www.blogsnow.com/ping
http://www.blogstreet.com/xrbin/xmlrpc.cgi
http://bulkfeeds.net/rpc
http://www.newsisfree.com/xmlrpctest.php
http://ping.blo.gs/
http://ping.feedburner.com
http://ping.syndic8.com/xmlrpc.php
http://ping.weblogalot.com/rpc.php
http://rpc.blogrolling.com/pinger/
http://rpc.technorati.com/rpc/ping
http://rpc.weblogs.com/RPC2
http://www.feedsubmitter.com
http://blo.gs/ping.php
http://www.pingerati.net
http://www.pingmyblog.com
http://geourl.org/ping
http://ipings.com
http://www.weblogalot.com/ping