How to disable XML-RPC from Linux command-line in a total way?
On nginx, to block access to the xmlrpc.php file, add this location block to the server block of your configuration file: location ~ ^/(xmlrpc\.php) { deny all; }
On nginx, to block access to the xmlrpc.php file, add this location block to the server block of your configuration file: location ~ ^/(xmlrpc\.php) { deny all; }
I came up with this solution. This function checks in each directory level starting from the directory of the current file for the file wp-config.php. If it is found the directory is to be assumed the wordpress base path. The check can of course be changed to other wordpress core files. function find_wordpress_base_path() { $dir … Read more
Here’s how I would go about doing this: First create a file with a hash for the file name within your theme directory – this one is md5(‘foobar’): 3858f62230ac3c915f300c664312c63f.php Within that file would be something like this: //Use the file name as an API key of sorts $file = explode(‘.’, basename(__FILE__)); $key = $file[0]; //Trigger … Read more
This is probably impossible since WP-CLI pass the arguments directly to wp_insert_posts. I’m automating this with wp eval. For example: wp eval ‘wp_set_object_terms(12 , array(1, 2, 3), “course”);’ The post id can be obtained when you create the post with –porcelain: wp post create … –porcelain Or by normal query with post title: wp eval … Read more
You can use real cron to trigger WP cron – by fetching wp-cron.php file from root (snippet from quick google search). That will take care of environment and everything.
I found that in the documentation for wp-cli it says [–<field>=<value>] Associative args for the new post. See wp_insert_post(). Which then subsequently shows: ‘page_template’ => [ <string> ] // Requires name of template file, eg. template.php. The command is wp post update 4 –page_template=”new-home.php”
LOCAL For local aliases, it works best to define your path ahead of time in the config.yml. Then keep the variables pretty clean by only specifying the url to target the site. Sorting the output helps if you have a long list of sites since the default is by blog id (which we’re not using). … Read more
This should get you started: Loop over all posts and build an array of linked image files Loop over all image attachments & cross check if any of them have been linked to Might need to batch it or boost the timeout & memory limit, depending on the server & number of posts you’re working … Read more
There is extensive documentation on the database structure of WordPress in the Codex. Its pretty simple but still you probably do not want to mess with the data directly. As you mentioned CLI I’d recommend WP-CLI which offers some commands you need. A quick example from the docs to change the name of the term … Read more
If you type wp help post create you will get all the info you need. Example: wp post create –post_type=page –post_status=publish –post_title=”A new page”