ACF | Post Types & jetpack_sitemap_post_types

The code in the provided GitHub Gist demonstrates how to extend Jetpack’s XML sitemap functionality to include all public custom post types (CPTs), including those registered via Advanced Custom Fields (ACF), without relying on the active theme. This approach offers several advantages:

✅ Advantages of Using a Theme-Independent MU Plugin

  1. Decouples Sitemap Logic from Theme: By placing the code in a must-use (MU) plugin, the sitemap customization remains active regardless of theme changes, ensuring consistent sitemap behavior across theme updates or switches.
  2. Automatic Inclusion of All Public CPTs: The get_dynamic_sitemap_post_types() function dynamically retrieves all public post types, including those registered by plugins like ACF, ensuring they are automatically added to the sitemap without manual updates.
  3. Excludes Non-Relevant Post Types: The code filters out post types such as ‘attachment’, ‘revision’, and ‘nav_menu_item’, which are typically not needed in sitemaps, ensuring a cleaner and more relevant sitemap.
  4. Persistent Across Plugin Updates: Since the customization is handled in an MU plugin, it remains unaffected by updates to Jetpack or other plugins, providing stability and reducing the risk of losing customizations.
  5. Centralized Management: Managing sitemap customizations in an MU plugin allows for easier maintenance and troubleshooting, as all related code is consolidated in one location.

This method leverages Jetpack’s jetpack_sitemap_post_types filter to modify the list of post types included in the sitemap, aligning with best practices for extending Jetpack’s functionality. citeturn0search0

If you need assistance integrating this approach into your WordPress site or have further questions, feel free to ask.

<?php
/*
Plugin Name: Dynamic Post Types in Jetpack Sitemap (MU)
Description: Dynamically includes all registered public post types (including ACF types) in the Jetpack XML sitemap.
Version: 1.4
Author: ChatGPT
REF: https://www.advancedcustomfields.com/resources/post-types-and-taxonomies/#registering-custom-post-types
REF: https://developer.jetpack.com/hooks/jetpack_sitemap_post_types/
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Get all registered public post types for Jetpack sitemap.
*
* @return array List of valid public post types.
*/
function get_dynamic_sitemap_post_types() {
static $cached_types = null;
if ( is_null( $cached_types ) ) {
$excluded_post_types = ['attachment', 'revision', 'nav_menu_item'];
$all_post_types = get_post_types(['public' => true], 'names');
$cached_types = array_diff($all_post_types, $excluded_post_types);
}
return $cached_types;
}
/**
* Add public post types to Jetpack sitemap.
*
* @param array $post_types Existing post types in the sitemap.
* @return array Modified list of post types.
*/
function dynamic_jetpack_sitemap_post_types( $post_types ) {
return array_unique(array_merge($post_types, get_dynamic_sitemap_post_types()));
}
/**
* Hook into Jetpack sitemap filter once plugins are fully loaded.
*/
add_action('plugins_loaded', function() {
if ( class_exists( 'Jetpack' ) && method_exists( 'Jetpack', 'is_module_active' ) && Jetpack::is_module_active( 'sitemaps' ) ) {
add_filter( 'jetpack_sitemap_post_types', 'dynamic_jetpack_sitemap_post_types' );
}
});

REF:

Install & Run Minikube Kubernetes locally on Apple silicon via QEMU w/ Homebrew

requirement(s):

% brew install qemu
...
% brew tap homebrew/services
...
% brew install socket_vmnet
..
% sudo brew services start socket_vmnet
...
% brew install minikube
...
% minikube start --driver qemu --network socket_vmnet
...
% #test
% kubectl config current-context
minikube
% kubectl get nodes
NAME       STATUS   ROLES           AGE     VERSION
minikube   Ready    control-plane   1m23s   vX.Y.Z
% kubectl version
Client Version: vX.X.X
Kustomize Version: vX.X.X
Server Version: vX.X.X
%

REF:

alternative way to start minikube is via Install Docker Desktop on Mac:

% brew install minikube
...
% minikube start --driver docker
...

REF:

Kali Linux root

    • VLC media player
# sed -i 's/geteuid/getppid/' $(which vlc)
# echo $?
0
# 

ERR_UNSAFE_PORT & Network.security.ports.banned.override

net neutrality



Save net neutrality in the US