Hide Name and Email fields from User Profile block

Hi folks, have an updated code for this purpose. Place it in page settings → Custom code → Head, replace the BLOCKID with your actual block name, save and preview/publish

<script>
window.addEventListener('block-loaded-BLOCKID', () => {
    setTimeout(()=>{
        if(document.querySelectorAll('#BLOCKID .wrapper-container>form .form-input-holder').length>2){
            let inputsToRemove = [...document.querySelectorAll('#BLOCKID .wrapper-container>form .form-input-holder')].splice(0, 2);
            inputsToRemove.forEach((input)=>{
                input.remove();
            })
        }
    }, 200)
});
</script>
1 Like