Skip to:
Content
Pages
Categories
Search
Top
Bottom

how to disable hyperlinks in bbpress forum


  • joseph33333
    Participant

    @joseph33333

    hello friends i am new in bbpress. I want small help please guide me how to disable hyperlinks and how to avoid url posting in forum

Viewing 1 replies (of 1 total)

  • Robkk
    Moderator

    @robkk

    -well i have not tried this but to disable any link on a post appearing you can go to settings>disscussion and then change the number of links to 1. So that you arent totally stripping links and only trying to only allow approved links like youtube.com from appearing.

    Hold a comment in the queue if it contains [1] or more links. (A common characteristic of comment spam is a large number of hyperlinks.)

    yes i know this is usually for comments but ive read some of these settings are either working on bbpress now or in the future.

    -you can also just strip the links from either working by using this function.
    plop it into your child themes funcitons.php or a functionality plugin.

    add_filter( 'bbp_kses_allowed_tags', 'ntwb_bbpress_custom_kses_allowed_tags' );
     
    function ntwb_bbpress_custom_kses_allowed_tags() {
    	return array(
     
    		// Links
    		'a'          => array(
    			'class'    => false,
    			'href'     => false,
    			'title'    => false,
    			'rel'      => false,
    			'class'    => false,
    			'target'    => false,
    		),
     
    		// Quotes
    		'blockquote' => array(
    			'cite'     => true,
    		),
     
    		// Span
    		'span'             => array(
    			'class'     => true,
    		),
    		
    		// Code
    		'code'       => array(),
    		'pre'        => array(
    			'class'  => true,
    		),
     
    		// Formatting
    		'em'         => array(),
    		'strong'     => array(),
    		'del'        => array(
    			'datetime' => true,
    		),
     
    		// Lists
    		'ul'         => array(),
    		'ol'         => array(
    			'start'    => true,
    		),
    		'li'         => array(),
     
    		// Images
    		'img'        => array(
    			'class'    => true,
    			'src'      => true,
    			'border'   => true,
    			'alt'      => true,
    			'height'   => true,
    			'width'    => true,
    		),
     
    		// Tables
    		'table'      => array(
    			'align'    => true,
    			'bgcolor'  => true,
    			'border'   => true,
    		),
    		'tbody'      => array(
    			'align'    => true,
    			'valign'   => true,
    		),
    		'td'         => array(
    			'align'    => true,
    			'valign'   => true,
    		),
    		'tfoot'      => array(
    			'align'    => true,
    			'valign'   => true,
    		),
    		'th'         => array(
    			'align'    => true,
    			'valign'   => true,
    		),
    		'thead'      => array(
    			'align'    => true,
    			'valign'   => true,
    		),
    		'tr'         => array(
    			'align'    => true,
    			'valign'   => true,
    		)
    	);
    }

    you might just delete all of the code specified for the a tag too and you will be fine

    delete

    // Links
    		'a'          => array(
    			'class'    => false,
    			'href'     => false,
    			'title'    => false,
    			'rel'      => false,
    			'class'    => false,
    			'target'    => false,
    		),
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar