forked from DevinVinson/WordPress-Plugin-Boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 1
Secure the functions
Moisés Barrachina Planelles edited this page Oct 4, 2023
·
1 revision
## Function load
The 'function_load' option of the menu is the function that the page executes before sending the HTML headers
By default all pages execute admin_permission_check_and_ids_required_check_function_load(), the executed function can be changed on
class-your-plugin-admin -> $this->admin_pages_function_load_default = "admin_permission_check_and_ids_required_check_function_load"
The function admin_permission_check_and_ids_required_check_function_load() checks if the admin capabilities are correct and if the id required data is not missing. In this function it works the 'go_to_parent' option of the menu (the id check only on Backend Frontend Template Pro)
This function can be called at the beginning of a custom function_load to check all before save changes
NOTE: id required data and go to parent are only BFT Pro options
The 'function' option of the menu is the main function that the page executes
By default all pages execute admin_permission_check_and_ids_required_and_optional_check_page_display(), the executed function can be changed on
class-your-plugin-admin -> $this->admin_pages_function_default = "admin_permission_check_and_ids_required_and_optional_check_page_display"
The function admin_permission_check_and_ids_required_and_optional_check_page_display() checks if the admin capabilities are correct and if the id required data is not missing
On a custom function there are functions for checking the access and to retrieve the ids:
* $this->admin_permission_check(): check the admin permissions and throw an error if needed. Recommended for use at the beginning of the function
* More functions on BFT Pro