Skip to:
Content
Pages
Categories
Search
Top
Bottom

Links being stripped in posts


  • dogwomble
    Participant

    @dogwomble

    Hi there,
    I’m trying to work out what’s actually going on here.
    Whenever any person (including myself as keymaster) inserts a link, it is stripped from the post when it gets displayed. All othe formatting seems to make it through.
    I have added the following code to the theme’s functions.php to try and enable this functionality:

    add_action( 'bbp_kses_allowed_tags','pyg_kses_allowed_tags',999,1);
    function pyg_kses_allowed_tags($input){
            return array(
    
                            // paragraphs
                    'p' => array(
                            'style'     => array()
                    ),
                    'span' => array(
                            'style'     => array()
                    ),
    
                    // Links
                    'a' => array(
                            'href'     => array(),
                            'title'    => array(),
                            'rel'      => array()
                    ),
    
                    // Quotes
                    'blockquote'   => array(
                            'cite'     => array()
                    ),
    
                    // Code
                    'code'         => array(),
                    'pre'          => array(),
    
                    // Formatting
                    'em'           => array(),
                    'strong'       => array(),
                    'del'          => array(
                            'datetime' => true,
                    ),
    
                    // Lists
                    'ul'           => array(),
                    'ol'           => array(
                            'start'    => true,
                    ),
                    'li'           => array(),
    
                    // Images
                    'img'          => array(
                            'src'      => true,
    
                            'border'   => true,
                            'alt'      => true,
                            'height'   => true,
                            'width'    => true,
                    )
    
            );
    }

    I have tried to find other documentation to try and work out why this is occurring and have drawn a blank. Anybody have any other suggestions?

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

  • dogwomble
    Participant

    @dogwomble

    I’ve probably realisedit’s a good idea to link to an example…

    Link is https://crispygeek.com/forums/topic/i-suppose-i-should-say-hi-d/#post-723


    Robin W
    Moderator

    @robin-w

    from that post, it appears that the links were working, but have stopped working ?


    dogwomble
    Participant

    @dogwomble

    Yeah, they were working previously but aren’t now. I’m a little stumped as to why.


    Robin W
    Moderator

    @robin-w

    hmmm…can only suggest that you try the basic fault finding….

    Themes

    As a test switch to a default theme such as twentytwenty, and see if this fixes.

    Plugins

    If that doesn’t work, also deactivate all plugins apart from bbpress and see if this fixes. if it does, re-enable one at a time to see which is causing the error.

    If you cannot do this to your site (say because it is live) then use the ‘troubleshooting’ features of this plugin to let you test without affecting other users

    Health Check & Troubleshooting

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