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
3155                do {
3156                     $alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
3157                     $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_type, $post_ID ) );
3158                     $suffix++;
3159                } while ( $post_name_check );
3160                $slug = $alt_post_name;
3161           }
3162      }
3163
3164      return apply_filters( 'wp_unique_post_slug', $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug );
3165 }
3166
3167 /**
3168  * Truncates a post slug.
3169  *
3170  * @since 3.6.0
3171  * @access private
3172  * @uses utf8_uri_encode() Makes sure UTF-8 characters are properly cut and encoded.
3173  *