Created
January 13, 2021 17:47
-
-
Save PechenkiUA/3aa5482e9e53f8e4d233a535b362b44e to your computer and use it in GitHub Desktop.
add field settings wp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_action( 'admin_init', 'wpse_57647_register_settings' ); | |
| /* | |
| * Register settings | |
| */ | |
| function wpse_57647_register_settings() | |
| { | |
| register_setting( | |
| 'general', | |
| 'html_guidelines_message', | |
| 'esc_html' | |
| ); | |
| add_settings_section( | |
| 'site-guide', | |
| 'Publishing Guidelines', | |
| '__return_false', | |
| 'general' | |
| ); | |
| add_settings_field( | |
| 'html_guidelines_message', | |
| 'COVID Text', | |
| 'wpse_57647_print_text_editor', | |
| 'general', | |
| 'site-guide' | |
| ); | |
| } | |
| /* | |
| * Print settings field content | |
| */ | |
| function wpse_57647_print_text_editor() | |
| { | |
| $the_guides = html_entity_decode( get_option( 'html_guidelines_message' ) ); | |
| echo wp_editor( | |
| $the_guides, | |
| 'sitepublishingguidelines', | |
| array( 'textarea_name' => 'html_guidelines_message' ) | |
| ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment