I’m developing a WordPress plugin for sale on Codecanyon, but it was rejected. I’m looking for technical advice from other developers. My questions are:
- Is it allowed to enqueue a JavaScript script as a PHP file / as inline script? Like that:
ob_start();
include plugin_dir_path( __FILE__ ) . 'widget.php';
$content_js = ob_get_clean();
$script .= $content_js;
wp_add_inline_script( 'my-script', $script );
The PHP file contains variables from DB and JSON, which is why I did it that way. If not, what is the best way to retrieve data from variables and JSON in the included JS file? Are inline scripts allowed at all? Can all widget settings be obtained inside a JS file via an AJAX request to the plugin function, and then built inside the ‘success’ function using the user’s settings?
2. Is it allowed to insert the basic HTML of the widget form via “add_action( ‘wp_footer’, ‘my_html_code’);” or better to create it entirely in JS?
-
Also, are there any external libraries that cannot be included in the plugin?
-
If my plugin has already been hard-rejected, will I be able to upload it to Codecanyon after making all the necessary changes?
-
Lastly, is it allowed to store widget settings in .json files?
P.S.: The plugin was rejected without explanation, so I don’t know what the reason is. These are the rudest questions, in my opinion. Your experience and time would be very valuable to me. Please support me