avoid_blog_page_permalink_collision

函数


avoid_blog_page_permalink_collision ( $data, $postarr )
参数
  • (array)
    $data
    An array of post data.
    Required:
  • (array)
    $postarr
    An array of posts. Not currently used.
    Required:
返回值
  • (array) The new array of post data after checking for collisions.
定义位置
  • wp-admin/includes/ms.php
    , line 709
引入
3.0.0
弃用

Avoids a collision between a site slug and a permalink slug.

In a subdirectory installation this will make sure that a site and a post do not use the
same subdirectory by checking for a site with the same name as a new post.

function avoid_blog_page_permalink_collision( $data, $postarr ) {
	if ( is_subdomain_install() ) {
		return $data;
	}
	if ( 'page' !== $data['post_type'] ) {
		return $data;
	}
	if ( ! isset( $data['post_name'] ) || '' === $data['post_name'] ) {
		return $data;
	}
	if ( ! is_main_site() ) {
		return $data;
	}
	if ( isset( $data['post_parent'] ) && $data['post_parent'] ) {
		return $data;
	}

	$post_name = $data['post_name'];
	$c         = 0;

	while ( $c 

			
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。