Add description to custom plugin setting

Using add_settings_field(); i am able to add my custom setting:

add_settings_field('AUTOPLAY', 'Auto Play', 'printAutoPlayCheckbox', 'my_settings');


function printAutoPlayCheckbox()
{
   $id = 'AUTOPLAY';
   $name = 'my_settings' . "[$id]";
   $options = get_option('my_settings');
   echo '<input type="checkbox" id="' . $id . '" name="' . $name . '" ' . checked(1, isset($options[$id]), false) . '" />';
}

Add description to custom plugin setting

Now i want to add a short description of this setting, something like that:

Add description to custom plugin setting

How can i do that? I couldn’t find it in the WordPress docs.

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

I’ve not seen this type of title settings layout in the admin pages, so it seems you’re parting away from it.

Otherwise note that the title field of add_settings_field() is unescaped, so in theory one could add some HTML code for new title layout.

Usually the description is added to the input field.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x