• Resolved bcxdeveloper

    (@bcxdeveloper)


    I was using the hook below to filter out all the meta fields. Unfortunately I now need only one meta info field (Entry Date). Is there a hook that we can use to disable specific meta info fields so that I can include Entry Date?

    Hook previously used:
    add_filter( ‘gfexcel_output_meta_info’, ‘__return_false’ );

    Resolved by using Default Enabled Meta Fields

    • This topic was modified 3 years, 6 months ago by bcxdeveloper.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Doeke Norg

    (@doekenorg)

    Hi @bcxdeveloper,

    Glad you already have a solution. For what it’s worth, here is an alternative.

    You can do it programmatically by using the gfexcel_field_disable_meta hook, and return true unless the $field->id equals the one you want to show. That way only that meta field is visible.

    Note that this only applies on the actual download, not the sorting table.

    For example:

    add_filter('gfexcel_field_disable_meta', function (bool $current_value, $field) {
        $visible_meta_fields = ['date_created'];
    
        return !in_array($field->id, $visible_meta_fields, true);
    });

    So you can prevent the export of those fields this way, but not the ability to drag and drop them in the sorting tables.

    Thread Starter bcxdeveloper

    (@bcxdeveloper)

    Excellent! This is exactly what I was looking for.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Disabling specific meta fields’ is closed to new replies.