请注意,WordPress附带WP_HTTP_IXR_CLIENT
这扩展了IXR_Client
. 所以更换
require_once ABSPATH . WPINC . \'/class-IXR.php\';
$rpc = new IXR_Client( \'http://localhost/wordpress/wordpress/xmlrpc.php\' );
使用:
require_once ABSPATH . WPINC . \'/class-IXR.php\';
require_once ABSPATH . WPINC . \'/class-wp-http-ixr-client.php\';
$rpc = new WP_HTTP_IXR_CLIENT( \'http://localhost/wordpress/wordpress/xmlrpc.php\' );
然后尝试更换:
$result = $rpc->query(
\'pingback.extensions.getPingbacks\',
\'http://localhost/wordpress/wordpress/2018/01/17/hallo-welt/&post_type=something\'
);
使用
$result = $rpc->query(
\'pingback.extensions.getPingbacks\',
\'http://localhost/wordpress/wordpress/2018/01/17/hallo-welt/?post_type=something\'
);
服务器方法
wp_xmlrpc_server::pingback_extensions_getPingbacks()
使用
url_to_postid()
函数将url转换为帖子ID。因此,请确保您的url在那里工作!
附:现在许多WordPress用户正在研究新的REST-API 而不是XML-RPC API.