ap_remove_stop_words_post_name( string $str )

Description #

Remove stop words from post name if option is enabled.

Parameters #

  • $str
    string (Required) Post name to filter.

Changelog #

VersionDescription
4.1.0Moved from includesask-form.php.
3.0.0Introduced.

Source #

File: includes/functions.php

function ap_remove_stop_words_post_name( $str ) {
	$str = sanitize_title( $str );

	if ( ap_opt( 'keep_stop_words' ) ) {
		return $str;
	}

	$post_name = ap_remove_stop_words( $str );

	// Check if post name is not empty.
	if ( ! empty( $post_name ) ) {
		return $post_name;
	}

	// If empty then return original without stripping stop words.
	return sanitize_title( $str );
}

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