Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter beyond55

    (@beyond55)

    Ah, that makes sense.

    I am using a query because I need to get the status of the post(s), not sure I can do that with count_user_posts()

    Tottally overlooked the fact, that I do not pass the user ID… :/

    Thanks

    @johnpaulb

    Thanks for your reply.
    The permalinks are already adjusted.

    I’ve looked trough some of the 301 redirect plugins – neither of them mentions any automatization. Keep in mind, I need to do this to roughly 500 pages, so I need a plugin that will do this automatically once I tell it what to replace, with what, so I can’t have a plugin that will simply redirect all old URLs to one page, but to a specific page for each and every url.

    I haven’t installed any of them yet, as I’m at home atm, but I will test them tomorrow. Maybe they do have this functionality.

    Thread Starter beyond55

    (@beyond55)

    Aha, it is now working. Thank you very much ??

    Thread Starter beyond55

    (@beyond55)

    Thank you for your answer.
    I’ve been trying to make that work, but the value keeps saying NULL.

    add_action( 'template_redirect', 'redirect_to_specific_page' );
    function redirect_to_specific_page() {
    $current_user = wp_get_current_user();
    	if (empty($the_user_id)) {
    		$the_user_id = $current_user->ID;
    	}
      
    $args = array(
        'property_type' => 'property',
        'author'    => $the_user_id,
        'post_staus'=> 'any'
    );
      
    function custom_count_post_by_author($args){
        query_posts( $args );
        $count = 0;
        if ( have_posts() ) :
             while ( have_posts() ) : the_post();
                $count++;
             endwhile; 
        endif;
        wp_reset_query();
        return $count;
    }
        var_dump(is_page('site1'), $count);
      if ( is_page( 'site1' ) && $count == "1" ) {
        wp_redirect( 'site2', 301 ); 
        exit;
     }
    }

    Maybe you can tell me what I’m doing wrong?

Viewing 4 replies - 1 through 4 (of 4 total)