Wordpress 在用户配置文件仪表板上显示自定义 USERMETA 字段?

标签 wordpress customization profile dashboard custom-fields

我已经添加并使用了来自 user_custom_hash 的 USERMETA 字段(称为: wp_usermeta ) table 。意思是我去过 Insert/Edit/Deleting某处代码中的字段。

之前不需要显示出来。
所以现在..

  • 如何显示这个 USERMETA Wordpress 管理仪表板的“用户配置文件”页面上的字段? (我的意思是管理仪表板上的“编辑用户”页面。)

  • 例如:
  • Custom Hash Key: __239cc68ba2423ddf67dcfcd4aa2fa83b__

  • 我的意思是,在这里的某个地方展示:

    enter image description here
    Note:Wordpress Version currently: 3.5.0

    最佳答案

    现在可以了,因为我自己拿到了,就像这样:

    add_action( 'show_user_profile', 'display_user_custom_hash' );
    add_action( 'edit_user_profile', 'display_user_custom_hash' );
    
    function display_user_custom_hash( $user ) { ?>
        <h3>USERMETA Fields</h3>
        <table class="form-table">
            <tr>
                <th><label>Custom Hash Key</label></th>
                <td><input type="text" value="<?php echo get_user_meta( $user->ID, 'user_custom_hash', true ); ?>" class="regular-text" readonly=readonly /></td>
            </tr>
        </table>
        <?php
    }
    
  • 将此代码段添加到 functions.php 的底部我当前主题文件夹的文件。

  • 注:上面的整个代码应该是正常的 ?>像以前一样对整个文件进行处理。

    关于Wordpress 在用户配置文件仪表板上显示自定义 USERMETA 字段?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16933131/

    相关文章:

    css - Wordpress - 更新页面后自定义 css 将不起作用

    python - 如何在 python 中使用 wordpress REST api 上传图像?

    php - 在管理员新订单电子邮件模板中添加应用的优惠券代码 - WooCommerce

    .net - 自定义app.config

    .net - 如何在 Visual Studio 2010 中组织外部工具?

    linux - 当用户从特定主机通过 SSH 登录时执行操作

    sonarqube - 在 SonarQube 中恢复质量配置文件时忽略的规则

    php - 隐藏 WooCommerce 中特定运输方式的结帐运输字段部分

    android - android中的圆形个人资料图片

    scala - 无法加载play.http.errorHandler-未调用自定义处理程序