Admin back end – get URL of file using file browser

You can scan the directory for files with glob() then loop throw the results and list them in a admin modal (thickbox) or just show the list within a admin metabox in the post editor. Here’s a little snippet that i was playing with. /** * Get HTML Article Files from uploads/articles * Support both … Read more

Call require_once form admin page with checkbox

I achieved my goal by doing an option check like so, which conditionally loads the various functions in module_2.php, in my main plugin file: // If the checkbox is checked, load module_2.php. if ( get_option( ‘my_checkbox_option’ ) ) { require_once MY_MODULES_PATH . ‘module_2.php’; }

Give admin_menu permission to specific users

To grant access to the menu for users with Editor role, in place of manage_options use publish_pages as the capability. To be able to guide you in the future, use the breakdown of capabilities listed in this page below. Pick a capability that is present only in the roles you’re targeting. https://wordpress.org/support/article/roles-and-capabilities/

Maintenance mode excluding site administrators

Only administrators already login will have access to the website, no one else. just change the $url variable to your url where you have the maintenance page desired. function wp_maintenance_mode() { if (!current_user_can(‘administrator’)) { $url = “your maintenance file url you want to display while is on maintenance”; wp_redirect( $url ); exit; } add_action(‘get_header’, ‘wp_maintenance_mode’); … Read more

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