/* * Smart Link - buenosconsejos.net/go/ * Destino: articulos aleatorios de crm.buenosconsejos.net */ add_action('template_redirect', function () { if (is_admin() || wp_doing_ajax()) { return; } $host = strtolower( explode(':', $_SERVER['HTTP_HOST'] ?? '')[0] ); $path = parse_url( $_SERVER['REQUEST_URI'] ?? '/', PHP_URL_PATH ); $path = trailingslashit( '/' . trim((string) $path, '/') ); // Solo actuar en el dominio principal /go/ if ( !in_array($host, [ 'buenosconsejos.net', 'www.buenosconsejos.net' ], true) || $path !== '/go/' ) { return; } // Evitar cache de redirecciones if (!defined('DONOTCACHEPAGE')) { define('DONOTCACHEPAGE', true); } nocache_headers(); header( 'Cache-Control: no-store, no-cache, must-revalidate, max-age=0', true ); $home = 'https://crm.buenosconsejos.net/'; $hostname = 'crm.buenosconsejos.net'; // Obtener entradas publicadas de CRM $posts = get_transient('smartlink_main_crm_posts'); if (!is_array($posts) || empty($posts)) { $response = wp_remote_get( $home . 'wp-json/wp/v2/posts?per_page=100&status=publish&_fields=link', [ 'timeout' => 8, 'headers' => [ 'Accept' => 'application/json' ] ] ); $posts = []; if ( !is_wp_error($response) && wp_remote_retrieve_response_code($response) === 200 ) { $data = json_decode( wp_remote_retrieve_body($response), true ); if (is_array($data)) { foreach ($data as $post) { $url = $post['link'] ?? ''; $parts = wp_parse_url($url); if ( is_array($parts) && ($parts['scheme'] ?? '') === 'https' && ($parts['host'] ?? '') === $hostname && !empty($parts['path']) && $parts['path'] !== '/' ) { $posts[] = $url; } } } } $posts = array_values(array_unique($posts)); if (!empty($posts)) { set_transient( 'smartlink_main_crm_posts', $posts, 120 ); } } // Si la API falla, enviar a la portada CRM if (empty($posts)) { wp_redirect($home, 302); exit; } // Evitar repetir la ultima entrada $last = isset($_COOKIE['main_crm_last']) ? wp_unslash($_COOKIE['main_crm_last']) : ''; $available = array_values(array_filter( $posts, function ($url) use ($last) { return $url !== $last; } )); if (empty($available)) { $available = $posts; } // Elegir articulo aleatorio $destination = $available[array_rand($available)]; setcookie( 'main_crm_last', $destination, [ 'expires' => time() + 86400, 'path' => '/go/', 'secure' => is_ssl(), 'httponly' => true, 'samesite' => 'Lax' ] ); // Redireccion temporal sin cache wp_redirect($destination, 302); exit; }, 1);

Why use robo-advisors for investing

As the markets twist, money slips away. It’s a harsh truth: traditional investing often feels like a club for the elite, with hefty fees and complex jargon gatecrashing your dreams of financial freedom. Yet, here’s the contradiction—robo-advisors, those automated investing platforms, democratize access to smart strategies without the bank-breaking costs. In this article, we’ll unpack…

Read Full News