gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-01 23:04:19 28 4
gpt4 key购买 nike

我已经添加并使用了来自 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/

    28 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com