Skip to content

Instantly share code, notes, and snippets.

@PechenkiUA
Created January 13, 2021 17:47
Show Gist options
  • Select an option

  • Save PechenkiUA/3aa5482e9e53f8e4d233a535b362b44e to your computer and use it in GitHub Desktop.

Select an option

Save PechenkiUA/3aa5482e9e53f8e4d233a535b362b44e to your computer and use it in GitHub Desktop.
add field settings wp
<?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