Adding WordPress Custom QuickTags :WP-Saviour

By WP Saviour •  Updated: 03/02/21 •  2 min read

The WordPress QuickTags API permits you to add buttons to the WordPress admin textual content material editor. To be honest, the textual content material editor may be a lot much less used than the rich editor, by the best way during which together with quick tags could also be pretty useful when repeating the similar duties pretty sometimes.

Proper right here is the itemizing of default quick tags provided in WordPress:

wordpress-quick-tags-7167407

As you may even see you could create quite a few form of buttons, assign an entry key to each of them and description your private personalized code merely.

In order so as to add a quick tag, you need to hook a personalized function to the admin_print_footer_scripts hook. Primarily, the idea is in order so as to add some personalized javascript code all through the admin footer. The brief tags API provides a builtin function known as addButton:

QTags.addButton( id, present, arg1, arg2, access_key, title, priority, event );

This function accepts eight arguments:

This is a full snippet that gives a WPSaviour hyperlink to the editor:

add_action('admin_print_footer_scripts','rc_quicktags');
function rc_quicktags() { ?>  QTags.addButton( 'WPsaviourlove', 'WPsaviourlove', '', '', 'w' );

WP Saviour