Change post format using custom field

I'm creating a theme using the CF Post Formats plugin. But I've run into some trouble I don't know how to solve. Here's what I want to be able to do: Create a new standard-format post Enter a url into the _format_link_url custom field If the custom field is not empty, on save/update, change the post format to 'link'; else, remain 'standard'. For whatever reason, I can't get set_post_format to work in this context (perhaps there's a conflicting update?). I …
Category: Web

Clean/filter HTML inserted to post content by XML RPC

An external service that uses XML RPC to publish some posts on my site adds some unwanted CSS styles and HTML to the post content. I would like to clean it up using a HTML cleaner that I've built based on DOMDocument and DOMXPath. My only question is how can I access the post_content before it is actually saved to the databse so I can run my cleaner on it? Perhaps there is a filter/action that I can use?
Category: Web

not well-formed (invalid token) at line 15, column 51, byte 720 when trying to parse XMLRPC call

I'm running WP 4.7.4. The site is a default site with no plugins activated other than the default plugins. I'm using the WordPress::XMLRPC Perl module to generate a getPost XMLRPC call for post #1 like so: my $obj = WordPress::XMLRPC->new({username => 'admin', password => 'xxxxxx', proxy => 'http://my.domain.com/'}); my $post = $obj->getPost(1); The full error is this: not well-formed (invalid token) at line 15, column 51, byte 720 at /usr/local/lib/x86_64-linux-gnu/perl/5.20.2/XML/Parser.pm line 187. <!DOCTYPE html> <html lang="en-US" class="no-js"> <head> <...snip...> </body> …
Category: Web

XMLRPC pingback.extensions.getPingbacks not work with parameters

I want to use the pingback.extensions.getPingbacks Method with parameters in the url, like post_type or page. I use the code below, but it doesn't work when I want to add a parameter and I get a fault code of 0 and an empty fault string, but it seems to work when I only pass the url without any parameters. Can anyone help me? <?php require_once 'class-IXR.php'; $rpc = new 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'); if(!$result) { echo 'Error [' . $rpc->getErrorCode() …
Category: Web

Can I disable xml-rpc by setting it to false?

I've been searching about it and came across with this snippet code, will it disable safely the xml-rpc? // set below line to false in /public_html/xmlrpc.php ... define( 'XMLRPC_REQUEST', true ); ... Update I've installed and activated Disable XML-RPC plugin, but the wordpress security scanner still showing it is enabled! (I'm newbie in wordpress/php code development ) Update2 I've installed wpscan and just use it to test my web site and here is the result for xml-rpc: [+] XML-RPC seems …
Category: Web

How to enable xmlrpc in WordPress 5?

How can I enable xmlrpc in WordPress 5? I followed some tutorials related to this topic, but I didn't find the check box in the Settings writhing panel. I got 403 Forbidden Access after every request. Thanks.
Category: Web

XMLRPC filtering through htaccess not working

My websites are hosted on a shared instance. They face regular xmlrpc DDoS. I've tried to put in place several mitigation practices to block those attacks : Installed a dedicated extension that disables xmlrpc Blocked xmlrpc through htaccess, on all hosted wordpress site on that instance, using two different codes : <Files xmlrpc.php> order deny,allow deny from all </Files> and RewriteRule ^xmlrpc\.php$ "http\:\/\/0\.0\.0\.0\/" [R=301,L] Yet I keep getting requests on that file. An example of access log i get is …
Category: Web

Azure WordPress deny access to xmlrpc

I am trying to disable xmlrpc.php by using a plugin and also by using .htaccess. But it doesn't seem to be working, when I hit example.com/xmlrpc.php I still get the following: XML-RPC server accepts POST requests only. I'm trying this in .htaccess file: # Block WordPress xmlrpc.php requests <Files xmlrpc.php> order deny,allow deny from all allow from xxx.xxx.xxx.xxx </Files> # BEGIN DS-XML-RPC-API # The directives (lines) between "BEGIN DS-XML-RPC-API" and "END DS-XML-RPC-API" are # dynamically generated, and should only be …
Category: Web

X-Pingback and XMLRPC

According to old post: How to secure WordPress XMLRPC?, every API require authentication. So, what is the point of adding X-Pingback in every public request? curl -I http://ma.tt .. X-Pingback: http://ma.tt/blog/xmlrpc.php Content-Type: text/html; charset=UTF-8 ..
Category: Web

Block only external access to wp-cron.php on OpenLiteSpeed

I use OpenLitespeed server with multiple Wordpress installation and want to restrict external access to some files, only allowing server itself to access them (for example to call cron), so: What I did: RewriteCond %{REMOTE_ADDR} !^127\.0\.0\.1 RewriteCond %{REQUEST_URI} wp-trackback.php|xmlrpc.php|wp-cron.php [NC] RewriteRule .* - [F,L] Result: /xmlrpc.php - returns 403 as expected; /wp-trackback.php - returns 403 as expected; /wp-cron.php - shows white page like it always does without any restrictions... Why so? Any suggestions?
Category: Web

How to stop xmlrpc attacks without disabling component to allow JetPack to work in WordPress?

I manage a WordPress website using an virtual machine in the cloud, and lately, I noticed a lot of unwanted requests to the xmlrpc.php component that are slowing down the site causing high CPU loads. If it was for me, I would disable it entirely, but the site uses the JetPack plugin which relies on xmlrpc. So, my question is: how to allow JetPack access to xmlrpc while blocking everyone else and without disabling xmlrpc on the server? The site …
Category: Web

XMLRPC won't connect?

I am using the latest version of Wordpress and trying to run a simple PHP script to create a wordpress post but unfortunately it isn't working. I am using Cloudflare plus have a webhost that is providing an SSL certificate if it matters. There are no errors in the PHP logs and nothing unusual in the Cloudflare logs... I am very confused where this is breaking :( PHP script: $usr = 'ABCXYZ'; $pwd = 'ABCXYZ'; $xmlrpc = 'https://www.ABCXYZ.com/xmlrpc.php'; $client = …
Category: Web

Avoid duplicate posts with xml rpc

I'm new to Wordpress and I'm not a developer. I'm running an IFTT applet that posts a WordPress post each time I upload a new video on my Youtube Channel. There is a bug with IFTT. It often posts the same post 2 or 3 times. Therefore, I'd like to avoid duplicates before they are published. I read on forums that I needed to add a XML RPC plugin. I tried this solution (Set up on Site B) XMLRPC Avoid …
Category: Web

How to validate XML-RPC post creation and cancel when needed?

I have an IFTTT recipe that creates posts for me on some occasion, but for some weird reason it creates three, sometimes four posts of the same content. I would like to add an add_action hook/callback to validate what will be a new post and, if it already exists, cancel the post, or move it to trash or something like it. I found the the xmlrpc_prepare_post but I don't think I can cancel it from there. Unless I can update …
Category: Web

PHP XMLRPC for WordPress: Adding meta tags and description

I have been trying to add WordPress posts by XMLRPC calls. The code is working but the tags and categories are not setting. I have tried almost every solution provided in every forum. PS: I am getting a few of the variables from another application -- that part is working correctly. <?php include("lib/xmlrpc.inc"); $function_name = "wp.newPost"; $url = "http://website.com/xmlrpc.php"; $category = array('3','1'); $tags = array('tag1', 'tag2'); $client = new xmlrpc_client($url); $client->return_type = 'phpvals'; $message = new xmlrpcmsg( $function_name, array( new …
Category: Web

How To Post WordPress Custom Post Types to Twitter via IFTTT

I have my wordpress site. Which has the normal "post" and a custom post type "download", I Currently use IFTTT, (If This Then That Service) to post my wordpress posts to Twitter. The IFTTT recipe works perfectly for my posts, and tweets as soon as I publish any post. You can check my site https://milyin.com, and my twitter account is https://twitter.com/milyincrealtors/ The problem is that, this works only for normal wordpress posts. I searched IFTTT for applets to include custom …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.