Example #1
0
 /**
  * Returns the stopwords for the current language
  *
  * @since 1.1.7
  * @deprecated 3.1 Use WPSEO_Admin_Stop_Words::list_stop_words() instead.
  *
  * @return array $stopwords array of stop words to check and / or remove from slug
  */
 function stopwords()
 {
     $stop_words = new WPSEO_Admin_Stop_Words();
     return $stop_words->list_stop_words();
 }
Example #2
0
/**
 * Removes stopword from the sample permalink that is generated in an AJAX request
 *
 * @param array  $permalink The permalink generated for this post by WordPress.
 * @param int    $post_ID The ID of the post.
 * @param string $title The title for the post that the user used.
 * @param string $name The name for the post that the user used.
 *
 * @return array
 */
function wpseo_remove_stopwords_sample_permalink($permalink, $post_ID, $title, $name)
{
    WPSEO_Options::get_instance();
    $options = WPSEO_Options::get_options(array('wpseo_permalinks'));
    if ($options['cleanslugs'] !== true) {
        return $permalink;
    }
    /*
     * If the name is empty and the title is not, WordPress will generate a slug. In that case we want to remove stop
     * words from the slug.
     */
    if (empty($name) && !empty($title)) {
        $stop_words = new WPSEO_Admin_Stop_Words();
        // The second element is the slug.
        $permalink[1] = $stop_words->remove_in($permalink[1]);
    }
    return $permalink;
}