How to remove private posts from RSS feeds?

The same way you would change which posts WP shows on any other screen, pre_get_posts! If you ever see WP pull in posts, and want to modify what it fetches from the DB, use the pre_get_posts filter E.g. something similar to this: add_action( ‘pre_get_posts’, function( \WP_Query $query ) { if ( !$query->is_feed() ) { return; … Read more

Forcing two or more custom post type to be private

You can add multiple compared condition variable in single if condition using logical OR operator. For more knowledge of Logical condition click function force_type_private($post) { if ($post[‘post_type’] == ‘my_post_type1’ || $post[‘post_type’] == ‘my_post_type2’) { $post[‘post_status’] = ‘private’; } return $post; } add_filter(‘wp_insert_post_data’, ‘force_type_private ‘);

Check the stored / cached WP_Query with transients on post change

Use the save_post hook to check if a post that is being saved is a portfolio page and reset the transient. add_action( ‘save_post’, ‘reset_portfolio_transient’, 10,3 ); function reset_portfolio_transient( $post_id, $post, $update ) { // Only set for portfolio post_type if ( ‘portfolio’ !== get_post_type($post) ) { return; } // delete old tranisent delete_transient( ‘randomizeProfiles’ ); … Read more

How to hide a page in wordpress made for menu

Just create a custom template template-redirect-home.php and assign it to that page and redirect to homepage on load with sth like this: add_action( ‘template_redirect’, function(){ if(is_page_template(‘template-redirect-home.php’)){ wp_safe_redirect( get_home_url(), 301, ”); } }); You can also use Custom links in the menu to not access the page directly from the menu.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)