How to sanitize user input?

I am not sure if this helpful or not. As s_ha_dum said, you should post how you are processing the submitted data and sending to db. But for starters, you might look at escaping the outputted data in the form: <input style=”width:100%” type=”text” name=”dataHow to sanitize user input?” id=”title” value=”<?php $title = get_option(‘data_test’); echo esc_attr($title[‘title’]); … Read more

How to run a external JavaScript file on wp-admin if admin, and other if normal user?

You need to register/enqueue your admin scripts on admin_enqueue_scripts, not on wp_enqueue_scripts. wp_enqueue_scripts is a front end hook. It won’t run on the admin pages. Secondly, is_admin() just checks whether the page is an admin page, not whether the user is an administrator. To check whether the user is an administrator use: $current_user = wp_get_current_user(); … Read more

Loading jQuery and jQuery plugin script files correctly [duplicate]

Add the jquery script as a dependency for your jquery-ticker.js and site.js files within the wp_enqueue_script function. Example: function bbc_frontend_script() { wp_enqueue_script(‘ticker’, plugins_url(“/js/jquery-ticker.js”, __FILE__), array( ‘jquery’ ) ); wp_enqueue_script(‘sitejs’, plugins_url(“/js/site.js”, __FILE__), array( ‘jquery’, ‘ticker’ ) ); } add_action( ‘wp_enqueue_scripts’, ‘bbc_frontend_script’ ); You also don’t have to enqueue jquery separately if you define it as a … Read more

Cache directory needed for plugin

If you observe how the popular caching plugins like WP Super Cache or W3TC utilize a cache folder within wp-content as well as other plugins who utilize uploads or cachable files it would be appropriate to create a folder within that structure. A side issue may arise if the user has a locked down folder … Read more