Ignore “empty” fields when saving

First you need to catch the input then you can save it from $_POST So i assume your input fields names are myplugin_id , myplugin_api_key and myplugin_checkbox what you are currently doing is just going to replace the option with myplugin_checkbox You can try function register_myplugin_settings() { if ( isset( $_POST[‘myplugin_id’] ) && ! empty( … Read more

Secure way to add JS Script to WordPress filesystem

Thank you @Tom J Nowell letting me think about this. I had to think about it the last day, and this is the safe way to do this. function lwb_jquery() { $message=””; // Multisite Support if( is_multisite()) { $uri = get_stylesheet_directory() . ‘/sites/’ . get_current_blog_id(). ‘/assets/js/lwb-script.js’; $file_path=”[AKTIVES THEME]/sites/” . get_current_blog_id() . ‘/assets/js/lwb-script.js’; if( !file_exists( $uri … Read more

the function do_settings_section($page) generate error “Allowed memory size of … bytes exhausted”

You seem to be creating a recursive loop. In stm_addmenu_auto_delete_event(), you register an admin page via add_menu_page() that has a callback of auto_delete_settings_callback: function stm_addmenu_auto_delete_event() { add_menu_page( ‘Automatic deletion’, ‘Automatic <br/> deletion’, ‘manage_options’, ‘manage-auto-delete-page’, ‘auto_delete_settings_callback’, In new_settings_auto_delete you register a settings field with a callback of auto_delete_settings_callback: function new_settings_auto_delete() { // … add_settings_field( ‘default_auto_delete_field’, ‘By … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)