Disable / hide example preview using elementor editor on page with shortcode

Always use output buffers with shortcode to ensure the content is captured and displayed only where shortcode is used. So your code will get modified as follows:

add_shortcode('apartmentList', function() {
     ob_start();
     include 'ApartmentLists/ApartmentListOne.php';
     return ob_get_clean();
});

Also, if you are looking to stop the display of the shortcode content completely on the Elementor Editor, you can add a simple condition as follows:

add_shortcode('apartmentList', function() {
     // Check if Elementor is rendering the backend
     if (is_admin() && isset($_REQUEST['action']) && $_REQUEST['action'] === 'elementor') {
         return ''; // Return an empty string in the Elementor editor
     }

     ob_start();
     include 'ApartmentLists/ApartmentListOne.php';
     return ob_get_clean();
});

is_admin() will check if the page is a backend page.

$_REQUEST['action'] === 'elementor' will check if the Elementor Editor is active.

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