Create a Post Cache by ID Using the Function Hook
This function is designed for manually creating page caches.
By calling wpfc_create_post_cache_by_id with a specific post ID, you can create caches for both the page and its categories, along with the page’s tags.
The function takes a single parameter, $post_id, which is the unique identifier of the post you want to cache. By using the post ID, the function can identify and cache the post’s content, metadata, or any other data associated with it.
//it creates cache for post id 1923. wpfc_create_post_cache_by_id(1923);
You can use the apply_filters() function to retrieve data. Here’s how you can use apply_filters to retrieve data.
$result = apply_filters('wpfc_create_post_cache_by_id', 1923); print_r($result);
The above example will output:
Array ( [0] => Array ( [url] => https://site.com/2022/12/26/indias-spiritual-city-that-sings/ [success] => 1 ) [2] => Array ( [url] => https://test.wpfc.ml/category/news/ [success] => 1 ) [3] => Array ( [url] => https://test.wpfc.ml/tag/city/ [success] => 1 ) [5] => Array ( [url] => https://test.wpfc.ml/tag/spiritual/ [success] => 1 ) )
Note: If the function is called from within a theme file, it returns false.