Is there any method in WordPress to check whether the content is generated for XMLRPC call like for Feeds

I have a plugin which echoes something before the content on webpage. Normally I don’t want it on feeds so I do this

if ( ! is_admin() && ! is_feed() )
  echo $script;

Now, when some one uses xmlrpc calls to get the posts, there is nothing I could check against to prevent my script geting echoed into the post. Is there any thing like is_xmlrpc() to check this?

Read More

Thanks in advance for any help!

Related posts

Leave a Reply

1 comment

  1. Not really, but you could create it yourself pretty easily (and I really suggest to wrap that into a function because the detection is not overly stable and you might need to change it):

    /**
     * @return bool
     */
    function is_xmlrpc() {
        return defined('XMLRPC_REQUEST') && XMLRPC_REQUEST;
    }
    

    This works because in xmlrpc.php at the very top that XMLRPC_REQUEST constant is being defined.