Function Reference: geodir_social_post_types_allowed

Change Log

Since: 1.2.6

Filters

‘geodir_social_post_types_not_allowed’ [Line: 1379]

‘geodir_social_post_types_allowed’ [Line: 1392]

Source Code

function geodir_social_post_types_allowed() {
    $post_types = get_post_types( array( 'public' => true ), 'objects' );
    
    $not_allowed = array('page', 'attachment', 'revision', 'nav_menu_item', 'wpi_invoice');
    $not_allowed = apply_filters('geodir_social_post_types_not_allowed', $not_allowed);
    
    $allowed = array();
    if (!empty($post_types)) {
        $gd_post_types = geodir_get_posttypes();
        
        foreach ($post_types as $post_type => $object) {
            if (!empty($object->labels->name) && !in_array($post_type, $not_allowed)) {
                $allowed[$post_type] = in_array($post_type, $gd_post_types) ? __($object->labels->name, 'geodirectory') : __($object->labels->name);
            }
        }
    }
    
    return apply_filters('geodir_social_post_types_allowed', $allowed);
}