If you click “Increase indent” in the visual editor it adds the following code into the text editor:

<p style="padding-left:30px;">

How to change it to text-indent: 30px; not affecting the core files?

I searched in a lot of files and didn’t found any piece of code that would be responsible for that.

Thanks.

2 Answers
2

You need to modify the TinyMCE settings object on instantiation:

Reference: TinyMCE documentation – content formatting

WordPress provides a filter for this very purpose called tiny_mce_before_init which you can use as follows:

function modify_tinymce_settings($settings) {

    $settings['indentation'] = '10px';

    return $settings;
}

add_filter('tiny_mce_before_init', 'modify_tinymce_settings');

If that does not work precisely, then dump the output of $settings in the hook above to see where values for indentation are held, they may be nested as part of a multi-dimensional array.

Leave a Reply

Your email address will not be published. Required fields are marked *