Changing upload directory for plugin uploads only

There must be something identifiable about your form data, such as your input names. Check for one or more of those and process accordingly. function custom_upload_dir($args) { if (isset($_POST[‘something’])) { $args[‘path’] = $args[‘basedir’] . “/mypath” . $args[‘subdir’]; $args[‘url’] = $args[‘baseurl’] . “/mypath” . $args[‘subdir’]; } return $args; } After some investigation, the only things I … Read more

How to make repeated component/block in Gutenberg

I think the best way to approach this is by creating 2 blocks with a parent -> child relationship. The child block would be a nested block only available within its parent block. Note the parent defined below. registerBlockType( ‘prefix/childblock’, { title: __( ‘Inner Child Block’ ), parent: [‘prefix/parentblock’], attributes:{ …//the rest of your block … Read more

How to edit the properties of a page programmatically?

If you look at the documentation, you can insert title, content, slug, etc. using wp_insert_post then use update_post_meta to assign the template to that post. You can write like this $post_arr = array( ‘post_title’=>’My title goes here’, ‘post_content’=>’This is my long content.’, ‘post_excerpt’ => ‘My Excerpt’, ‘post_status’ => ‘publish’, ); $new_post_id = wp_insert_post($post_arr); Then set … Read more

“Donate to this plugin” for WordPress.org Plugin Authors

It is read from the infos on your plugins readme.txt. Example from my Default Values for Attachments === Plugin Name === Contributors: moraleida.me Donate link: http://moraleida.me/ Tags: attachments, default values, caption, title, description Requires at least: 2.5 Tested up to: 3.3.2 Stable tag: 0.1 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html