Team! Hope you are well today :) I'm trying to remove

Hello Team!

Hope you are well today :slight_smile:

I'm trying to remove the custom fields meta box in the 'add product' page WP backend and would love your help! Also what does this box do?

Cheers

  • Anang
    • New Recruit

    Hi Greg

    Hope you have a great day too :slight_smile:

    As I know you're using custom admin themes, so I will give you another CSS to hide this metabox in your products dashboard. Custom Fields metabox is to added extra custom field to your post, custom fields usually used for adding additional data to your post, for example you want to add vendor name on your post, you can use this custom field box . And you need to called it from code to get the value you entered there :slight_smile:

    Anyway here's the code to hide this from your product dashboard :

    function my_remove_metafield() {
    $screen=get_current_screen();
    if ($screen->post_type=='product')
    echo '<style>
        #postcostum {
          display:none;
        }
      </style>';
    
    }
    add_action('admin_head', 'my_remove_metafield');

    Let me know if that's worked :slight_smile:

    Best Regards

  • Anang
    • New Recruit

    Hi Greg

    I've check again , seems there's some typo in my previous code, could you try this one ?

    function my_remove_metafield() {
    $screen=get_current_screen();
    if ($screen->post_type=='product')
    echo '<style>
        #postcustom {
          display:none;
        }
      </style>';
    
    }
    add_action('admin_head', 'my_remove_metafield');

    Let me know the result :slight_smile:

    Best Regards

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.