Remove Buttons From Distraction-Free Writing

Want even fewer distractions in DFW? Remove some of the buttons

add_filter( 'wp_fullscreen_buttons', 'remove_fullscreen_buttons' );
function remove_fullscreen_buttons( $buttons ) {
	unset($buttons['bullist']);
	unset($buttons['numlist']);
	unset($buttons['1']);
	return $buttons;
}

Here are the buttons you have to work with:

$buttons = array(
	// format: title, onclick, show in both editors
	'bold' => array( 'title' => __('Bold (Ctrl + B)'), 'onclick' => 'fullscreen.b();', 'both' => false ),
	'italic' => array( 'title' => __('Italic (Ctrl + I)'), 'onclick' => 'fullscreen.i();', 'both' => false ),
	'0' => 'separator',
	'bullist' => array( 'title' => __('Unordered list (Alt + Shift + U)'), 'onclick' => 'fullscreen.ul();', 'both' => false ),
	'numlist' => array( 'title' => __('Ordered list (Alt + Shift + O)'), 'onclick' => 'fullscreen.ol();', 'both' => false ),
	'1' => 'separator',
	'blockquote' => array( 'title' => __('Blockquote (Alt+Shift+Q)'), 'onclick' => 'fullscreen.blockquote();', 'both' => false ),
	'image' => array( 'title' => __('Insert/edit image (Alt + Shift + M)'), 'onclick' => "fullscreen.medialib();", 'both' => true ),
	'2' => 'separator',
	'link' => array( 'title' => __('Insert/edit link (Alt + Shift + A)'), 'onclick' => 'fullscreen.link();', 'both' => true ),
	'unlink' => array( 'title' => __('Unlink (Alt + Shift + S)'), 'onclick' => 'fullscreen.unlink();', 'both' => false ),
	'3' => 'separator',
	'help' => array( 'title' => __('Help (Alt + Shift + H)'), 'onclick' => 'fullscreen.help();', 'both' => false )
);

Allow Non-Standard Tags in the Editor

If you find yourself needing to add non-standard tags to the WordPress editor, you may also find yourself feeling very frustrated. With just a little bit of code, you can tell the editor to accept extra tags

add_filter( 'tiny_mce_before_init', 'mce_extended_valid_elements', 10, 2);
function mce_extended_valid_elements( $mceInit, $editor_id ) {
	//allow only the basic tag
	//$mceInit['extended_valid_elements'] .= ',sometag';
	//allow the tag and a attribute
	$mceInit['extended_valid_elements'] .= ',sometag[someattribute]';
	//allow the tag and multiple attribute
	//$mceInit['extended_valid_elements'] .= ',sometag[someattribute|anotherattribute]';
	//allow the tag and any attribute
	//$mceInit['extended_valid_elements'] .= ',sometag[*]';
	return $mceInit;
}

Limit Spellchecker Languages

If you don’t want your spellchecker dropdown to be too big, you can limit the available languages. Cut it down to only a few, or even just one.

add_filter('mce_spellchecker_languages', 'limit_spellchecker_languages');
function limit_spellchecker_languages() {
	//original: +English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv
	return '+English=en';
}

Allow HTML in User Descriptions

By default, WordPress will remove any HTMl from the user bio field on the edit user/profile screen.

It’s very easy to stop WordPress from doing this

remove_filter( 'pre_user_description', 'wp_filter_kses' );

However, you probably don’t want to leave it at that, as users could then add any code (iframes, scripts, etc.) and it wouldn’t be removed.

add_filter( 'pre_user_description', 'wp_filter_post_kses' );

Change the “Enter title here” Placeholder Text

If “Enter title here” is just to boring for you, change it.

Could be especially useful for custom post types that use the title field in an untraditional manner.

add_filter( 'enter_title_here', 'change_enter_title_text', 10, 2 );
function change_enter_title_text( $text, $post ) {
        return 'The title. Don't forget to double-check your spelling before publishing.';
}

Add More to User Row Actions

Need to quickly see more than the default information on the Users page? Here’s how to get and display each users website:

add_filter( 'user_row_actions', 'user_row_actions_show_website', 10, 2 );
function user_row_actions_show_website( $actions, $user_object ) {
	$actions['website'] = make_clickable( $user_object->user_url );
	return $actions;
}