<子>Edit: 是的,我知道,我自己回答了这个问题。然而,我仍然对我找到的其他解决方案和/或评论感兴趣。你会这样做吗?还有其他方法吗edit.php) 用于自定义帖子类型。
根据edit.php
(以及class-wp-list-table.php
和class-wp-posts-list-table.php
) 没有合适的挂钩。
那么,我该怎么做呢?
注意事项:
我想出了一个解决方案,我会说它有点老土,所以我愿意接受一个干净的解决方案(如果有)
<子>Edit: 是的,我知道,我自己回答了这个问题。然而,我仍然对我找到的其他解决方案和/或评论感兴趣。你会这样做吗?还有其他方法吗edit.php) 用于自定义帖子类型。
根据edit.php
(以及class-wp-list-table.php
和class-wp-posts-list-table.php
) 没有合适的挂钩。
那么,我该怎么做呢?
注意事项:
我想出了一个解决方案,我会说它有点老土,所以我愿意接受一个干净的解决方案(如果有)
我有点觉得我错过了一些明显的东西,但也许我没有。那么admin_notices
胡克,对我来说似乎是个显而易见的选择。您可以使用一些管理CSS类,如updated
, error
或update-nag
, 或者你当然可以添加你自己的风格,比如“问”和“答”here 或here.
Code:
<?php
function my_cpt_info() {
if (\'edit-my_cpt\' === get_current_screen()->id) {
?>
<div class="updated">
<p>
<?php _e(\'Some information about my CPT...\', \'my-text-domain\'); ?>
</p>
</div>
<?php
}
} // function my_cpt_info
add_action(\'admin_notices\', \'my_cpt_info\');
?>
目前,我正在这样做:
劫持批量更新消息调整更新的计数
function my_cpt_info($messages) {
if (\'edit-my_cpt\' === get_current_screen()->id) {
global $bulk_counts;
$bulk_counts[\'updated\'] = 1;
if (! is_array($messages))
$messages = array();
$messages[\'my_cpt\'][\'updated\'] = \'Whatever it is that I need to explain about this post type, I just do it right here...<br>\';
return $messages;
}
} // function my_cpt_info
add_filter(\'bulk_post_updated_messages\', \'my_cpt_info\', 0);
我决定接受保护/wp-admin 目录使用。htaccess网站不断遭到黑客攻击。每当我上传时。htaccess访问/wp-admin, 我的浏览器显示/wp-admin 具有重定向循环。这是/wp-admin/.htaccess:AuthUserFile /.../.htpasswd AuthType Basic AuthName “restricted” Order Deny,Allow Deny from all Require valid-user