add_action( 'template_redirect', 'redirect_to_specific_page' );
function redirect_to_specific_page() {
global $post;
$current_user = $post->post_author;
if(!empty($current_user)){
$user_post_count = (int) count_user_posts( $current_user );
if ( is_page('butiktest') && $user_post_count == 1 ) {
wp_redirect( 'enhytte', 301 );
exit;
}
}
}
authorized user: $current_user = wp_get_current_user();
Related Posts:
- How to mark every 3rd post
- Count posts within a custom post type and specific taxonomy and terms?
- How to Display a List of Users Who Have Made at Least 1 Post?
- How to Display Network Post Count?
- How to cache a shortcode functions output?
- Count posts in category including child categories
- Count singular post views automatically
- Set font size automatically according to number of words in post
- Network wide post count (WP Multisite)
- Alternate custom content in the loop
- Show that current post is number X out of X
- Show the author’s count of total amount of posts assign to a custom taxonomy term
- Double count view in archive.php
- Count to how many categories a post belongs to
- Count total number across post types
- Count search results in heading
- How to hide first gallery for every post?
- Counter of posts ever posted – even deleted ones
- Display Published Posts Count for Certain Time Period
- How can I get global $post to work for CPT and update user?
- Display Notification Bar on Header on Certain Post Count
- Show posts count for Categories and Tags in wp_nav_menu
- How to add category post count in main navigation menu [closed]
- Count number of posts of current month
- Howto show comment count by post in post?
- Counter is skipping post when I still want it visible [closed]
- Count several post tags
- Get post number both in the loop and in the post
- How do I insert a after every 5 posts in a WordPress Loop that infinitely loads posts?
- Count the number of a post types associated with another post type
- Echo the number of posts being displayed
- Display amount of pending posts in back/front end
- Count user posts and store the number for later use
- why the posts queried from sql is more than those showed on the page?
- Count the total views of all user posts published
- Author post count in category
- Set post title font size automatically according to number of words in post title
- Show post count in custom taxonomy page
- Count singular post views automatically
- How to count posts in tags within time limit
- Display Custom Post Category Count & WordPress Category Count Using Shortcode
- Counting Posts by Category
- Display number of post published every day
- Retrieve posts inside foundation tabs and tab-content split by 3 per row
- Alternative content between posts no repetition
- count_posts to a standalone link
- How to control Post view count incresing in sidebar widget posts too?
- How to mark every 3rd post
- Add a minimum word count to Excerpt (and how to force Excerpt as a rule for WyPiekacz)
- How to limit the number of posts a user can publish based on user type
- ho can I get the number of the current post instead of the post id?
- post_count not working
- Adding Count Post in Page
- Count words for all posts by all authors
- Word count for all posts of all authors
- Display post count on archive page in reverse order
- Stop WordPress automatically adding tags to post content
- Let private posts stay in status “private” after edit through “editors”
- how to get a different html for odd/even posts?
- Exclude posts that only have the ‘Uncategorized’ category [duplicate]
- How to display posts by current user/author in a custom page template?
- featuring old articles without messing up with the archive
- Display most recent post in category instead of archive?
- Include related posts on a page
- White screen of death on post save only
- How do I batch create revisions of all posts?
- How to get only text from wordpress post content?
- I want to get title name of post, but i didn’t get by this code. Any suggestion?
- How to modify post content?
- Allow public to post on blog
- Facebook doesn’t display the related thumbail for some posts
- custom post type category count shortcode
- Emojis replaced by ‘?’ automatically
- Creating a post from data returned from HTML form
- Get Post’s first image using Short-code
- Delete post results in “Cannot delete or update a parent row: a foreign key constraint fails”
- Modify posts listing at back end
- How to update all posts at once?
- How to allow multiple thumbnail upload for Posts?
- Random posts that always include a particular post?
- Show number of posts by logged in user
- How does WP decide how to display a page
- Insert data from custom created PHP page into wp_postmeta table
- Internal linking to posts permalink fail because of spaces and stripe at postname
- How to implement a WordPress comments function?
- How can I restore posts from ‘trash’ with their previous post_status? – WordPress
- Shortcode for Comments and Comment Boxes in Post Loop
- My page shows some other content in WP
- Weird problem occurs while using WordPress REST API to create new post
- Dropdown Select Post Filter
- Add postmeta to all blog posts
- Enable HTML Tags in WordPress Post excerpt
- How to give priority to page than to posts permalink structure?
- Add category information beneath post?
- how to remove entry meta from wordpress archive category and change its display
- Save/retrieve form data best practises for theme development
- Changing permalink of custom category
- Special Query: Title, Terms, Content – %LIKE%
- Error establishing a database connection
- Add News Feed to bespoke website, only to one page on whole site