Is hint for translator compulsory while internationalizing a string containing variables?

The notes to translators aren’t required, as far as I can tell, but they will definitely help anyone out who’s trying to translate your plugin. You might want to think of them as best practices rather than requirements. As to your second question: Since WordPress 4.6 translations now take translate.wordpress.org as priority and so plugins … Read more

Can woocommerse be used dynamically for billing from another plugin for payment processing?

It is possible, but you’re going to need a product to log in your orders. You could create a product ‘placeholder’ and then pass variables to the cart before checkout. This way the actual product already exists but everything else in WooCommerce will perform as normal. Orders don’t store a link to the current price … Read more

Plugin language always shows WP site language, not profile language

I found the solution: In the constructor I had to add this public function __construct() { // your code goes here add_action( ‘plugins_loaded’, [$this, ‘load_text_domain’] ); // your code goes here } public function load_text_domain() : void { load_plugin_textdomain(‘your-plugin-textdomain’); } This finally made sure that the language displayed followed the settings of the user profile … Read more

How to make my shortcode load scripts and styles, from within the plugin?

plugins_url expects the second parameter to be the main plugin file, which is why __FILE__ is used in examples, it’s assuming the code is in that file, but yours is not. To fix this, you will need to retrieve __FILE__ in your main plugin file, store it, and pass it to your shortcode objects for … Read more

Sanitizing file & directory form input

The function that you would want to use is sanitize_text_field() which among other things, strips all HTML tags, and remove line breaks, tabs and extra white space. // This worked fine for me – I got /directory/subdirectory/ $value = sanitize_text_field( ‘/directory/subdirectory/’ ); // And so does this one – I got /thisfile.min.js $value = sanitize_text_field( … Read more