There is such a code:
// Заголовок add_settings_field( 'title_element', 'Заголовок', 'title_callback', 'about_options', 'about_section' ); // Подзаголовок add_settings_field( 'subtitle_element', 'Подзаголовок', 'subtitle_callback', 'about_options', 'about_section' ); After it comes this code
// Заголовок function title_callback() { echo '<input type="text" id="title_element" name="about_options[title_element]" value="' . get_option( 'about_options' )[ 'title_element' ] . '" />'; } // Подзаголовок function subtitle_callback() { echo '<input type="text" id="subtitle_element" name="about_options[subtitle_element]" value="' . get_option( 'about_options' )[ 'subtitle_element' ] . '" />'; } It can be seen that title_callback and subtitle_callback are the same, only the id is different, I want the function to accept the id as a variable, but I don’t know how to do it, I tried this:
// Подзаголовок add_settings_field( 'subtitle_element', 'Подзаголовок', 'subtitle_callback("id")', 'about_options', 'about_section' ); Does not work! How to transfer a variable there?
subtitle_callbackis the name of the callback function. No arguments of this function so not to push. The code will not work. And as it should - read my answer. - KAGG Design