Redirect not logged in users if they are on a specific page and category

In you actual code you can see this:

if ( is_user_logged_in() || ! is_page() ) return;

This code does this: if user is logged in or is not in a page, then return/do nothing. You need to remove ! is_page():

add_action( 'template_redirect', function() {

    if ( is_user_logged_in() ) return;

    $restricted = array( 250, 253 ); // all your restricted pages

    if ( in_array( get_queried_object_id(), $restricted ) ) {
        wp_redirect( site_url( '/user-registration' ) ); 
        exit();
    }

});

Alternatively you can leave is_page() and add also the check for is_category() as your needs.

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