Skip to:
Content
Pages
Categories
Search
Top
Bottom

Allow only TinyCEM HTML


  • alexandra440382
    Participant

    @alexandra440382

    Hello there!

    I want to allow only the HTML tags and attributes that TinyMCE version 6 uses by default throughout my entire forum.

    I am not so much a techie but can fiddle slightly in PHP

Viewing 3 replies - 1 through 3 (of 3 total)

  • Robin W
    Moderator

    @robin-w

    try

    function rew_enable_visual_editor( $args = array() ) {
        $args['tinymce'] = true;
        $args['teeny'] = false;
        return $args;
    }
    add_filter( 'bbp_after_get_the_content_parse_args', 'rew_enable_visual_editor' );

    Put this in your child theme’s function file –

    ie wp-content/themes/%your-theme-name%/functions.php

    where %your-theme-name% is the name of your theme

    or use

    Code Snippets


    alexandra440382
    Participant

    @alexandra440382

    I had been using that one, now I’m switching to the latest version of tinyMCE (https://www.tiny.cloud/get-tiny/) and I’ve been trying to make it do the same (enable HTML for it only).

    I’ve tried this function with no succeeds

    add_filter( 'bbp_kses_allowed_tags', 'ntwb_bbpress_custom_kses_allowed_tags' );
    
    function ntwb_bbpress_custom_kses_allowed_tags() {
    	return    array(
        'a' => array(
            'href' => true,
            'target' => true,
            'rel' => true,
            'title' => true
        ),
        'abbr' => array(),
        'acronym' => array(),
        'address' => array(),
        'applet' => array(),
        'area' => array(
            'shape' => true,
            'coords' => true,
            'href' => true,
            'alt' => true
        ),
        'article' => array(),
        'aside' => array(),
        'audio' => array(
            'src' => true,
            'controls' => true
        ),
        'b' => array(),
        'base' => array(
            'href' => true,
            'target' => true
        ),
        'basefont' => array(),
        'bdi' => array(),
        'bdo' => array(),
        'big' => array(),
        'blockquote' => array(
            'cite' => true
        ),
        'body' => array(),
        'br' => array(),
        'button' => array(
            'type' => true,
            'name' => true,
            'value' => true
        ),
        'canvas' => array(
            'width' => true,
            'height' => true
        ),
        'caption' => array(),
        'center' => array(),
        'cite' => array(),
        'code' => array(),
        'col' => array(
            'span' => true
        ),
        'colgroup' => array(
            'span' => true
        ),
        'data' => array(
            'value' => true
        ),
        'datalist' => array(),
        'dd' => array(),
        'del' => array(
            'cite' => true
        ),
        'details' => array(),
        'dfn' => array(),
        'dialog' => array(),
        'dir' => array(),
        'div' => array(),
        'dl' => array(),
        'dt' => array(),
        'em' => array(),
        'embed' => array(
            'src' => true,
            'type' => true
        ),
        'fieldset' => array(),
        'figcaption' => array(),
        'figure' => array(),
        'font' => array(),
        'footer' => array(),
        'form' => array(
            'action' => true,
            'method' => true
        ),
        'frame' => array(),
        'frameset' => array(),
        'h1' => array(),
        'h2' => array(),
        'h3' => array(),
        'h4' => array(),
        'h5' => array(),
        'h6' => array(),
        'head' => array(),
        'header' => array(),
        'hr' => array(),
        'html' => array(),
        'i' => array(),
        'iframe' => array(
            'src' => true,
            'width' => true,
            'height' => true
        ),
        'img' => array(
            'src' => true,
            'alt' => true,
            'width' => true,
            'height' => true
        ),
        'input' => array(
            'type' => true,
            'name' => true,
            'value' => true
        ),
        'ins' => array(
            'cite' => true
        ),
        'kbd' => array(),
        'label' => array(
            'for' => true
        ),
        'legend' => array(),
        'li' => array(),
        'link' => array(
            'href' => true,
            'rel' => true,
            'type' => true
        ),
        'main' => array(),
        'map' => array(
            'name' => true
        ),
        'mark' => array(),
        'menu' => array(),
        'menuitem' => array(),
        'meta' => array(
            'name' => true,
            'content' => true
        ),
        'meter' => array(),
        'nav' => array(),
        'noframes' => array(),
        'noscript' => array(),
        'object' => array(
            'data' => true,
            'type' => true,
            'width' => true,
            'height' => true
        ),
        'ol' => array(),
        'optgroup' => array(
            'label' => true
        ),
        'option' => array(
            'value' => true
        ),
        'output' => array(),
        'a',
        'abbr',
        'address',
        'area',
        'article',
        'aside',
        'audio',
        'b',
        'base',
        'bdi',
        'bdo',
        'blockquote',
        'body',
        'br',
        'button',
        'canvas',
        'caption',
        'cite',
        'code',
        'col',
        'colgroup',
        'data',
        'datalist',
        'dd',
        'del',
        'details',
        'dfn',
        'dialog',
        'div',
        'dl',
        'dt',
        'em',
        'embed',
        'fieldset',
        'figcaption',
        'figure',
        'footer',
        'form',
        'h1',
        'h2',
        'h3',
        'h4',
        'h5',
        'h6',
        'head',
        'header',
        'hr',
        'html',
        'i',
        'iframe',
        'img',
        'input',
        'ins',
        'kbd',
        'label',
        'legend',
        'li',
        'link',
        'main',
        'map',
        'mark',
        'menu',
        'menuitem',
        'meta',
        'meter',
        'nav',
        'noscript',
        'object',
        'ol',
        'optgroup',
        'option',
        'output',
        'p',
        'param',
        'picture',
        'pre',
        'progress',
        'q',
        'rp',
        'rt',
        'ruby',
        's',
        'samp',
        'script',
        'section',
        'select',
        'small',
        'source',
        'span',
        'strong',
        'style',
        'sub',
        'summary',
        'sup',
        'svg',
        'table',
        'tbody',
        'td',
        'template',
        'textarea',
        'tfoot',
        'th',
        'thead',
        'time',
        'title',
        'tr',
        'track',
        'u',
        'ul',
        'var',
        'video',
        'wbr',
     
    	);
    }

    Robin W
    Moderator

    @robin-w

    sorry, I am not a tinymce expert, so can’t really help further

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar