how can i show less fields in user profile

My site doesn't need to show billing address and another fields. How can i hide them in user profile page?

  • Vaughan

    Hi Personatas,

    Hope you're well?

    This will depend on what fields exactly you want removing.

    With regards to the billing/shipping fields with coursepress, I believe they are actually added to the profile via the marketpress plugin.

    You should be able to remove theme by adding the following to your theme functions.php

    add_action('plugins_loaded', 'remove_actions', PHP_INT_MAX);
    function remove_actions()
    {
        global $mp;
        if ($marketpress instanceof MarketPress) {
            $list = array(
                'show_user_profile' => 'user_profile_fields',
                'edit_user_profile' => 'user_profile_fields',
                'personal_options_update' => 'user_profile_update',
                'edit_user_profile_update' => 'user_profile_update'
            );
    
            foreach ($list as $action => $func) {
                $p = has_action($action, array($marketpress, $func));
                //var_dump($p);
                if ($p) {
                    remove_action($action, array($marketpress, $func), $p);
                }
            }
        }
    }

    Hope this helps

  • Vaughan

    Hi,

    It might need to be used in a mu-plugin instead.

    Create a file called functions.php

    Add the following to the file.

    <?php
    add_action('plugins_loaded', 'remove_actions', PHP_INT_MAX);
    function remove_actions()
    {
        global $mp;
        if ($marketpress instanceof MarketPress) {
            $list = array(
                'show_user_profile' => 'user_profile_fields',
                'edit_user_profile' => 'user_profile_fields',
                'personal_options_update' => 'user_profile_update',
                'edit_user_profile_update' => 'user_profile_update'
            );
    
            foreach ($list as $action => $func) {
                $p = has_action($action, array($marketpress, $func));
                //var_dump($p);
                if ($p) {
                    remove_action($action, array($marketpress, $func), $p);
                }
            }
        }
    }

    Then upload to /wp-content/mu-plugins

    If mu-plugins doesn't exist, create it.

    Hope this helps

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.