Make WordPress Core

Opened 8 years ago

Closed 5 years ago

Last modified 4 years ago

#36890 closed enhancement (fixed)

TinyMCE: add settings for the wptextpatterns plugin to add or override the default text patterns

Reported by: azaozz's profile azaozz Owned by:
Milestone: 4.7 Priority: normal
Severity: normal Version:
Component: TinyMCE Keywords:
Focuses: Cc:


Continues from #33300.

Currently a WordPress plugin has to replace the whole wptextpattern editor plugin to add or change the text patterns. It would be better to let the patterns be changed by setting an editor option in the init array.

Attachments (1)

36890.patch (5.5 KB) - added by azaozz 8 years ago.

Download all attachments as: .zip

Change History (6)

8 years ago

#1 @azaozz
8 years ago

36890.patch is almost identical to It adds editor settings to add or override the default text patterns.


add_filter( 'tiny_mce_before_init', 'textpatterns_test' );
function textpatterns_test( $init ) {
	$init['wptextpattern_inline_patterns'] = '{
		strong: { start: "*", end: "*", format: "bold" },
		strong2: { start: "**", end: "**", format: "bold" },
		em: { start: "_", end: "_", format: "italic" }

	return $init;

This ticket was mentioned in Slack in #core-editor by mrwweb. View the logs.

8 years ago

#3 @iseulde
8 years ago

We added this in [39075]. :) The question now is if we should add methods to add and remove patterns more easily and/or if we should add any PHP filters just for this. At the moment you can only replace the settings.

#4 @azaozz
5 years ago

  • Milestone Future Release deleted
  • Resolution set to fixed
  • Status changed from new to closed

The code added in [39075] seems sufficient.

#5 @SergeyBiryukov
4 years ago

  • Milestone set to 4.7
Note: See TracTickets for help on using tickets.