This function checks if a specific post is set for sale in the Sell Content add-on. This can be due to all posts of this type is set for sale or in manual mode, if the post has been selected to be for sale.

This function is only available if the Sell Content add-on is enabled.

Available since version 1.7


(bool) TRUE if the post is for sale else FALSE.


Param Type Required Description
function mycred_post_is_for_sale(
$post_id int or obj Yes

Either a post object ID or a post object.

) { ... }


Example 1: Check if the current post, based on the $post global, is set for sale.

global $post;

if ( mycred_post_is_for_sale( $post ) ) {

	// Post is set for sale