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 Editions, where some are only available in the Pro Edition, 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.


acf_views/card/query_args (Pro)

acf_views/card/query_args/id={cardId} (Pro)

acf_views/card/posts_data (Pro)

acf_views/card/posts_data/card_id={cardId} (Pro)

acf_views/card/custom_variables (Pro)

acf_views/card/custom_variables/card_id={cardId} (Pro)



Query Args (Pro)

Allows to customize WP_Query arguments that are used to get posts for a 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.

  • $card_id (string) Unique ID of the current ACF Card

  • $page_number (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 $posts_data, string $card_dd, int $page_number, \WP_Query $query, array $query_args): 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);
  • $custom_variables (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}

  • $card_id (string) Unique ID of the current 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);

Last updated