Advertisements

avoid_blog_page_permalink_collision

Definition:
function avoid_blog_page_permalink_collision( $data, $postarr ) {}

Parameters

  • $data
  • $postarr

Source code

function avoid_blog_page_permalink_collision( $data, $postarr ) {

	if ( is_subdomain_install() )

		return $data;

	if ( $data['post_type'] != 'page' )

		return $data;

	if ( !isset( $data['post_name'] ) || $data['post_name'] == '' )

		return $data;

	if ( !is_main_site() )

		return $data;



	$post_name = $data['post_name'];

	$c = 0;

	while( $c < 10 && get_id_from_blogname( $post_name ) ) {

		$post_name .= mt_rand( 1, 10 );

		$c ++;

	}

	if ( $post_name != $data['post_name'] ) {

		$data['post_name'] = $post_name;

	}

	return $data;

}

551

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: