AnsPress_Bad_words::before_inserting_question( boolean $return, string $str )

Description #

Hook to check bad words before inserting question into database.

Parameters #

  • $return
    boolean (Required) Return ajax response or boolean.
  • $str
    string (Required) Question form fields.

Changelog #

VersionDescription
2.4.5Introduced.

Source #

File: addons/free/bad-words.php

	public static function before_inserting_question( $return, $str ) {
		$bad_words = SELF::find_bad_words( $str );

		if ( false === $bad_words || empty( $bad_words ) ) {
			return $return;
		}

		return array(
			'form' 		 => ap_sanitize_unslash( 'ap_form_action' ),
			'success'  => false,
			'snackbar' => [ 'message' => __( 'Don’t use foul or abusive language. Let everything you say be good and helpful.', 'anspress-question-answer' ) ],
			'action'	 => 'bad_word_detected',
		);

	}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment