ACF Card

Customize a query (WP_Query) that is used to get posts for a Card.
Please make sure you've installed the latest version of the plugin before using these filters.
Some filters are common and available in both the Basic and Pro plugin versions, where some are only available in the Pro version, these have been labelled as "(Pro)".
Do you need to customize something but a filter isn't available? Then Contact us and we'll try to add it as soon as possible.



Query Args (Pro)

Allows to customize WP_Query arguments that are used to get posts for an ACF Card.
add_filter('acf_views/card/query_args', function ($args, $cardId, $pageNumber) {
// any modifications to the $args here
return $args;
}, 10, 3);
  • $args (array) Arguments for WP_Query. See all available here.
  • $cardId (int) ID of the current ACF Card
  • $pageNumber (int) Current page number. By default 1, has another number only within the AJAX pagination.

Posts Data (Pro)

Allows to apply PHP filtering to the posts found.
function (array $postsData, int $cardId, int $pageNumber, \WP_Query $query, array $queryArgs): array {
// todo your modifications to the $postsData['postIds'] or $postsData['pagesAmount']
return $postsData;

Custom Card Variables (Pro)

Allows to add custom variables to the custom markup.
add_filter('acf_views/card/custom_variables', function ($customVariables, $cardId) {
// any modifications to the $customVariables here
return $customVariables;
}, 10, 2);
  • $customVariables (array) An associative array of values, where keys are variable names. These variables can be accessed in the custom markup with brackets, like {VARIABLE_NAME}
  • $cardId (int) ID of the current ACF Card

Shortcode output

It’s a built-in WordPress hook that allows modifying the output of the whole shortcode. Code example shown below. Read more here.
add_filter('do_shortcode_tag', function ($output, $tag, $attr) {
if ('acf_cards' != $tag) {
return $output;
// todo my custom changes for $output
return $output;
}, 10, 3);