Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation on how to remove the 'Other' Tab #84

Open
baden03 opened this issue Jun 14, 2023 · 0 comments
Open

Documentation on how to remove the 'Other' Tab #84

baden03 opened this issue Jun 14, 2023 · 0 comments

Comments

@baden03
Copy link
Contributor

baden03 commented Jun 14, 2023

In the past I have used the wp_user_profiles_core_files filter to basically rewrite the entire default sections like so:

add_filter( 'wp_user_profiles_core_files', 'my_custom_tabs', 10, 2 );
function my_custom_tabs($files, $sources){
		$path = plugin_dir_path( __FILE__ );
		$files[1] = $path . 'my_custom_user_profile_tabs.php'; // override the standard profile.php
		unset($files[7]); //all-status.php
		unset($files[20]); //profile-name.php
		unset($files[30]); //sections.php
		return $files;
	}

That was fine when I had to do some serious customisation. But now I only want to accomplish two things:

  1. remove the Other Tab (for editing one's own profile and others)
  2. Add my own fantastic custom tabs.

In crawling through the source code I run across the wp_user_profiles_show_other_section filter in sections.php, but it's not doing what you'd think it should, namely: show_other_section as in:

add_filter( 'wp_user_profiles_show_other_section', '__return_false');

So, what would be the recommended procedure for simply removing a single section like the catch-all 'other' tab?
Once this is settled (or improved if needed) I will happily expand the README.md with some more detailed documentation and even an example or two under:

Can I add my own sections?

Yes. There are a filters you can use to add or remove sections and their metaboxes.

p.s. will also fix the typo in the above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant