Skip to:
Content
Pages
Categories
Search
Top
Bottom

bbpress Bad Words Error customize


  • hamza21
    Participant

    @hamza21

    Hi,
    I have added Words which are not allowed in the replies of forum in my Settings>Discussions>Disallowed Comment Keys and once I enter any of these words in replies of any of my forums posts an error is shown Your reply cannot be created at this time.

    Basically I want to customize the error and change it to my custom error which can be seen by user, I tried many ways like overwriting it by using hooks in my theme php file but not succeeded.

    Any help would be appreciated.

    Thanks.

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

  • Robin W
    Moderator

    @robin-w

    try

    function rew_change_text( $translated_text, $text, $domain ) {
    	if ( $text == '<strong>Error</strong>: Your reply cannot be created at this time.') {
    	$translated_text = '<strong>Error</strong>: New moderation message';
    	}
    	return $translated_text;
    }
    
    add_filter( 'gettext', 'rew_change_text', 20, 3 );

    hamza21
    Participant

    @hamza21

    It shows nonce_failure error when I add the above code in my theme function.php file.


    Robin W
    Moderator

    @robin-w

    can you give me the exact error please


    hamza21
    Participant

    @hamza21

    nonce_failure
    its the exact error which I am getting.


    Robin W
    Moderator

    @robin-w

    ok, Can you show a few lines above and below where you put it in the functions file?


    hamza21
    Participant

    @hamza21

    Nonce-error

    Error Image


    Robin W
    Moderator

    @robin-w

    hmmm…

    try using

    Code Snippets

    The code works fine in my functions file

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