How to set CORS header?

Fixed it by adding Header set Access-Control-Allow-Origin “*” in apache2.conf: <Directory /var/www/> Options Indexes FollowSymLinks AllowOverride None Require all granted Header set Access-Control-Allow-Origin “*” </Directory>

How do you install the automattic developer plugin under localhost for mamp when there is an error, deprecated?

As you are using PHP 5.5+ versions, the old PHP 4 things will throw errors … of course. The error comes from – as you can read – the WordPress importer plugin, which is some kind of badly treated step child of WordPress. plugins/wordpress-importer/wordpress-importer.php:38 One solution is to use our fork with fixes from wecodemore/GitHub, where you can … Read more

Add a do_action to post_content of wp_insert_post

@Peter van der Net, here my approach, I create shortcode for newly created page. So we don’t have to save element form into database, and it make easy by user if they need move form to another page by shortcode. For submission, I use hook wp and handle data of form submission. For your issue, … Read more

What user roles should have wp_unique_post_slug_is_bad_flat_slug filter applied?

Actually you should skip the condition altogether – you don’t need to worry about permissions or context here, you are merely saying: If WordPress, for whatever reason, is determining if a slug is bad: run my additional conditions Currently, if a theme/front-end plugin/REST API call was triggering the filter (i.e. insert/updating a post), your checks … Read more

Skip file when plugin updated

On you future code files in your plugin, do not include the ‘option’ file in the repository. Since it is not included in the repository zip, the file (if it exists) will not be overwritten on the user’s system. You may need some code in your plugin to create the file on activation with some … Read more

Automatically translating from existing .po and .mo files?

Solved by adding if ( isset( $_POST[‘language’] ) ) { // Input var okay. add_filter( ‘locale’, ‘mbd_set_my_locale’ ); /** * Set locale based on the $_POST choice. * * @param string $locale Locale code. * @return string Selected locale code. */ function mbd_set_my_locale( $locale ) { $language = sanitize_text_field( wp_unslash( $_POST[‘language’] ) ); // Input … Read more