I used wp-types toolset to create a custom post type and a post relationship to pages; there is now a Post Relationships section at the bottom of every page edit screen. The problem is, I would only like this section to show up on a couple of pages.
Is there something I can add to functions.php (or another alternative) to hide this section from all page edit screens expect for those particular ones.
The section div id that I want to hide is #wpcf-post-relationship and the data post id of the pages that I would like it to be visible are 143 and 23.
— (update) —
The easy way is to use a simple CSS rule with the ‘admin_head’ hook, to do it, like this:
1) create a css file named
hide_some_field.css
and put it into your active child theme folder, with this code:2) Add this code in your active child theme functions.php file:
If you use a theme instead, change:
get_stylesheet_directory_uri()
byget_template_directory_uri()
.Another similar alternative (without an external CSS file) is: