What is the difference between private and protected members of C++ classes?

What is the difference between private and protected members in C++ classes? I understand from best practice conventions that variables and functions which are not called outside the class should be made private—but looking at my MFC project, MFC seems to favor protected. What’s the difference and which should I use? 19 Answers 19

get_terms(); show private posts when logged in

Hi have a custom post type “FAQ”. I got some “FAQ’s” that are private, also only visible for logged in users. I used “get_terms()” funktion for a widget that is listing links to the categories of those “FAQ’s”. The “get_terms” does not list the terms, that have only private “FAQ’s”. $taxonomy = ‘faq_kategorien’; $tax_terms = … Read more

Redirect to login when on private page, and when logged in to specific page

I´m using a plugin called “private content login redirect”. The plugin is actually only containing this piece of code: add_action(‘template_redirect’, ‘private_content_redirect_to_login’, 9); function private_content_redirect_to_login() { global $wp_query,$wpdb; if (is_404()) { $private = $wpdb->get_row($wp_query->request); $location = wp_login_url($_SERVER[“REQUEST_URI”]); if( ‘private’ == $private->post_status ) { wp_safe_redirect($location); exit; } } } What it does is this: When a non-logged … Read more

Forum plugin that allows private groups that are invite only [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 9 years … Read more

Using a private method as an action callback from within a class

I have created a class from within which I would like to call a private method (from within the same class) from the __construct method as an action callback. When I would like to use a public method I can access it by: add_action( ‘init’, array( $this, ‘action_callback’ ) ); However, this causes an error … Read more

Exclude Private, Draft pages from Primary Nav when using custom menu

I’m looking for ways to prevent “private” and “draft” pages from appearing (to non-logged-in admins) in a site’s Primary Navigation menu which is based on a custom menu – other than manually removing such pages from the WP custom menu and then dragging them back when they are published, that is. FWIW, I’m surprised the … Read more