wordpress检查

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了wordpress检查相关的知识,希望对你有一定的参考价值。

  1. function save_taxonomy_data($post_id) {
  2. // verify this came from our screen and with proper authorization.
  3.  
  4. if ( !wp_verify_nonce( $_POST['taxonomy_noncename'], 'taxonomy_theme' )) {
  5. return $post_id;
  6. }
  7.  
  8. // verify if this is an auto save routine. If it is our form has not been submitted, so we dont want to do anything
  9. if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )
  10. return $post_id;
  11.  
  12.  
  13. // Check permissions
  14. if ( 'page' == $_POST['post_type'] ) {
  15. if ( !current_user_can( 'edit_page', $post_id ) )
  16. return $post_id;
  17. } else {
  18. if ( !current_user_can( 'edit_post', $post_id ) )
  19. return $post_id;
  20. }
  21.  
  22. // OK, we're authenticated: we need to find and save the data
  23. $post = get_post($post_id);
  24. if (($post->post_type == 'post') || ($post->post_type == 'page')) {
  25. // OR $post->post_type != 'revision'
  26. $theme = $_POST['post_theme'];
  27. wp_set_object_terms( $post_id, $theme, 'theme' );
  28. }
  29. return $theme;
  30.  
  31. }

以上是关于wordpress检查的主要内容,如果未能解决你的问题,请参考以下文章

WordPress:检查是不是安装了插件(ACF)

wordpress:如何检查 slug 是不是包含特定单词?

Wordpress - 通过检查用户状态从 bbPress 外部更改论坛角色

检查 mysql 数据库中的 Wordpress 版本

如何检查 WordPress 中是不是启用了 XML-RPC

Wordpress:在前端检查自定义用户角色