1. Home
  2. Docs
  3. Divi Query Builder
  4. Action & Filter Hook...
  5. Alter Post Data

Alter Post Data

Overview

The filter hook ctdqb_get_post_data allows you to modify or extend the post data array that is collected for each post within the Query Builder loop. This filter provides access to all the gathered post information and enables you to add custom data or modify existing values before the post is rendered.

Hook Parameters

  1. $props – Array of module properties.
  2. $post_data – Array containing all collected post data and metadata.

Understanding the Post Data Array

The $post_data array contains comprehensive information about each post:

Core Post Data

  • id – Post ID
  • title – Post title
  • type – Post type
  • mime – MIME type array (for attachments)
  • permalink – Post URL
  • classes – Array of post CSS classes

Author Information

  • author – Author display name
  • author_id – Author user ID
  • author_a – Author avatar HTML
  • author_link – Author archive URL

Date Information

  • published – Published date (formatted)
  • modified – Last modified date (formatted)

Content Data

  • excerpt – Post excerpt (when enabled)
  • content – Post content (when content display is enabled)
  • cc – Comment count array

Media Data

  • img_html – Featured image HTML
  • img_url – Featured image URL
  • img_caption – Image caption
  • img_data – Array with full image URL and title

Taxonomy Data

  • term_links – Array of associated taxonomy terms with links

Custom Fields

  • custom_fields – Array of custom field data
  • custom_fields_html – Rendered custom fields HTML
  • cf_link – Custom field link value

WooCommerce Data (for products)

  • woo – Array containing product-specific data like price, SKU, stock, etc.

Divi Layout Data

  • dl_content – Divi layout content (when enabled)

0 Comments

Submit a Comment

How can we help?