Skip to main content

Discount

For loop type edd_discount, here are the query parameters and fields.

Query parameters

  • author - Include by author ID, login name, or 'current'
    Type: string, array

  • category - Include by category ID, slug, or 'current'
    Type: string, array

  • custom_date_field - Filter by given custom date field - Faster than using 'field', this queries raw field values in the database
    Type: string, array

  • custom_date_field_compare - Compare using one of: 'equal' (default), 'not', 'before', 'before_inclusive', 'after'
    Type: string, array

  • custom_date_field_format - For custom date field query, specify the date format of the field value - Default is 'Ymd'; For date-time field, set 'Y-m-d H:i:s'. If it's a timestamp, use 'timestamp'. For custom field plugins other than ACF, you may need to use a different format.
    Type: string

  • custom_date_field_type - For custom date field query, one of: date (default), time, datetime, number
    Type: string

  • custom_date_field_value - Filter by given custom date field value, or 'current'
    Type: string

  • custom_field - Filter by given custom field - Faster than using 'field', this queries raw field values in the database
    Type: string

  • custom_field_compare - Compare using one of: 'equal' (default), 'not', 'before', 'before_inclusive', 'after', 'after_inclusive'
    Type: string

  • custom_field_type - For custom field query, one of: string (default), number, date, time, datetime
    Type: string

  • custom_field_value - Filter by given custom field value
    Type: string

  • exclude - Exclude by ID or name
    Type: string, array

  • exclude_author - Exclude by author ID, login name, or 'current'
    Type: string, array

  • exclude_category - Exclude by category ID, slug, or 'current'
    Type: string, array

  • exclude_parent - Exclude by parent ID or name
    Type: string, array

  • exclude_tag - Exclude by tag ID, slug, or 'current'
    Type: string, array

  • id - ID
    Type: string, array

  • ignore_sticky_posts - Ignore sticky posts
    Type: boolean - Default: true

  • include - Include by ID or name
    Type: string, array

  • include_children - Include children
    Type: boolean

  • name - Name/slug
    Type: string, array

  • order - Order: asc (ascending) or desc (descending)
    Type: string - Default: asc

  • orderby - Order by one of: id, author, title, name, type, date, modified, random, comment_count, relevance, menu
    Type: string - Default: title

  • orderby_field - Order by custom field
    Type: string

  • orderby_field_number - Order by custom field whose value is a number
    Type: string

  • page - Page number
    Type: number - Default: 1

  • paged - Posts per page
    Type: number - Default: -1

  • parent - Include by parent ID or name
    Type: string, array

  • publish_compare - Publish date comparison - One of: 'before', 'before_inclusive', 'after', 'after_inclusive'
    Type: string

  • publish_date - Filter by publish date in Y-M-D format, 'today', 'X days ago' and other values compatible with strtotime() - Optionally use 'publish_compare' attribute
    Type: string

  • publish_day - Filter by given publish day of the month, from 1 to 31, or 'current'
    Type: number

  • publish_month - Filter by given publish month, from 1 to 12, or 'current'
    Type: number

  • publish_week - Filter by given publish week, from 1 to 54, or 'current' - Note: the 'publish_compare' attribute is not supported for this field
    Type: number

  • publish_year - Filter by given publish year, or 'current'
    Type: number

  • search - Search by given keyword - Prepending a keyword with a hyphen '-' will exclude posts matching it
    Type: string

  • status - Status
    Type: string, array - Default: active,inactive,expired

  • tag - Include by tag ID, slug, or 'current'
    Type: string, array

  • taxonomy_2 - See attribute 'taxonomy'
    Type: number, string

  • taxonomy_3 - See attribute 'taxonomy's
    Type: number, string

  • taxonomy_compare - One of 'in' (default), 'not', 'and', 'exists', and 'not exists'.Use with 'taxonomy' attribute
    Type: number, string

  • taxonomy_compare_2 - See attribute 'taxonomy_compare'
    Type: number, string

  • taxonomy_compare_3 - See attribute 'taxonomy_compare'
    Type: number, string

  • taxonomy_relation - When using more than one 'taxonomy' queries, can specify 'and' or 'or'
    Type: string

  • terms - Include by taxonomy term ID, slug, or 'current'.Use with 'taxonomy' attribute
    Type: number, string, array

  • terms_2 - See attribute 'terms'
    Type: number, string, array

  • terms_3 - See attribute 'terms'
    Type: number, string, array

  • type - Post type(s)
    Type: array, string - Default: post

Fields

  • amount - Retrieve the amount of discount

  • code - Retrieve the code used to apply the discount

  • excluded_products - Retrieve the downloads that are excluded from having this discount code applied. Returns a Loop.

  • expiration - Retrieve the end date

  • id - ID of post object

  • is_not_global - Retrieve the property determining if a discount is not global

  • is_single_use - Retrieve the usage limit per limit (if the discount can only be used once per customer)

  • max_uses - Retrieve the maximum uses for the discount code

  • min_price - Retrieve the minimum spend required for the discount to be satisfied

  • name - Retrieve the name of the discount

  • product_condition - Product condition

  • start - Retrieve the start date

  • status - Retrieve the status of the discount

  • status_label - Retrieves the status label of the discount

  • type - Retrieve the type of discount

  • uses - Retrieve the uses for the discount code