是的,有。将此代码另存为插件并激活一个插件。插件将锁定所有包含来自编辑的子级的页面。
<?php
/*
Plugin Name: Lock parent pages form edit
Plugin URI:
Description:
Version: 0.1
Author: Alexey Selin <[email protected]>
Author URI: http://wordpress.stackexchange.com/users/7314/alexey
*/
function lock_parent_pages_from_edit( $capauser, $capask, $param){
global $wpdb;
$post = get_post( $param[2] );
$children = get_pages(\'child_of=\'.$post->ID);
if( count( $children ) > 0 ) {
if( $param[0] == "edit_page" ) {
foreach( (array) $capask as $capasuppr) {
if ( array_key_exists($capasuppr, $capauser) ) {
$capauser[$capasuppr] = 0;
}
}
}
}
return $capauser;
}
add_filter(\'user_has_cap\', \'lock_parent_pages_from_edit\', 100, 3 );
?>