HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux wordpress-ubuntu-s-2vcpu-4gb-fra1-01 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64
User: root (0)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/linde/wp-content/plugins/lindevr-site-plugin/faqs/yoast.php
<?php


/**
  * Excludes specific posts from the Yoast SEO sitemap based on an ACF field value.
  *
  * This function hooks into the 'wpseo_exclude_from_sitemap_by_post_ids' filter provided by
  * the Yoast SEO plugin to modify the list of post IDs excluded from the generated XML sitemap.
  * It targets posts where a custom Advanced Custom Fields (ACF) field named 'post_visibility'
  * has the value 'lva-platform', ensuring these posts are not included in the sitemap.
  */
 function exclude_lva_platform_posts_from_sitemap($excluded_ids) {
 
     // Try to get cached excluded posts
     $posts_to_exclude = get_transient('excluded_lva_platform_posts');
 
     // If no cache found, run the query
     if ( false === $posts_to_exclude ) {
 
         $args = array(
             'post_type'      => 'linde_faq',
             'posts_per_page' => -1,
             'fields'         => 'ids',
             'meta_query'     => array(
                 array(
                     'key'     => 'post_visibility',
                     'value'   => 'lva-platform',
                     'compare' => '='
                 )
             )
         );
 
         $posts_to_exclude = get_posts($args);
 
         // Store in transient cache for 12 hours
         set_transient('excluded_lva_platform_posts', $posts_to_exclude, 12 * HOUR_IN_SECONDS);
     }
 
     return array_merge($excluded_ids, $posts_to_exclude);
 }
 
 add_filter('wpseo_exclude_from_sitemap_by_post_ids', 'exclude_lva_platform_posts_from_sitemap');


 ?>