Welcome, visitor! Log in
 

Source View: wp_unique_post_slug

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

  • Action hooks look like this: do_action( "hook_name" )
  • Filter hooks look like this: apply_filters( "hook_name", "what_to_filter" ).

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
3148                do {
3149                     $alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
3150                     $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_type, $post_ID ) );
3151                     $suffix++;
3152                } while ( $post_name_check );
3153                $slug = $alt_post_name;
3154           }
3155      }
3156
3157      return apply_filters( 'wp_unique_post_slug', $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug );
3158 }
3159
3160 /**
3161  * Truncates a post slug.
3162  *
3163  * @since 3.6.0
3164  * @access private
3165  * @uses utf8_uri_encode() Makes sure UTF-8 characters are properly cut and encoded.
3166  *