[wp-trac] [WordPress Trac] #38327: Inline docs indicate wp_default_editor filter accepts an array but it actually filters a string
WordPress Trac
noreply at wordpress.org
Mon Oct 17 03:20:31 UTC 2016
#38327: Inline docs indicate wp_default_editor filter accepts an array but it
actually filters a string
--------------------------+-----------------------------
Reporter: goto10 | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Editor | Version: 4.6.1
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
Looking at `wp_default_editor()` inside general-template.php, the
`wp_default_editor` filter takes the string `$r` (which is either
'tinymce', 'html', or 'test'), but the inline docs suggest that an array
is being filtered.
{{{
/**
* Find out which editor should be displayed by default.
*
* Works out which of the two editors to display as the current editor for
a
* user. The 'html' setting is for the "Text" editor tab.
*
* @since 2.5.0
*
* @return string Either 'tinymce', or 'html', or 'test'
*/
function wp_default_editor() {
$r = user_can_richedit() ? 'tinymce' : 'html'; // defaults
if ( wp_get_current_user() ) { // look for cookie
$ed = get_user_setting('editor', 'tinymce');
$r = ( in_array($ed, array('tinymce', 'html', 'test') ) )
? $ed : $r;
}
/**
* Filters which editor should be displayed by default.
*
* @since 2.5.0
*
* @param array $r An array of editors. Accepts 'tinymce', 'html',
'test'.
*/
return apply_filters( 'wp_default_editor', $r );
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38327>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list