BeAPI / acf-options-for-polylang

A WordPress plugin for adding ACF options page support for Polylang.
https://wordpress.org/plugins/acf-options-for-polylang/
Other
169 stars 28 forks source link

Exclude ACF sub_page #83

Open Loosie94 opened 1 year ago

Loosie94 commented 1 year ago

Version information

Hi guys, I'm trying to exclude a sub options page. ACF function:

acf_add_options_sub_page([
        "page_title" => __("Timer", "timer"),
        "menu_title" => __("Timer", "timer"),
        "menu_slug" => "timer",
        "post_id" => "timer",
        "redirect" => false,
        "position" => "6",
        "parent_slug" => "options",
        "icon_url" => "dashicons-list-view",
        "update_button" => __("Save", "timer"),
    ]);

How can I exclude this one from the plugin? I'm trying the filter like this:

    add_filter('bea.aofp.excluded_post_ids', function ($ids) {
        $ids[] = 'timer';
        return $ids;
    }, 10, 1);

But that doesn't seem to work. Any idea what I'm doing wrong? Thanks in advance!

PtrLarsson commented 6 months ago

@Loosie94 I think you can use the beabea.aofp.get_default-hook to see what post_id the field belongs to. Just var_dump the the $post_id and you should se it above each value fetched from the option pages.

# functions.php
add_filter('bea.aofp.get_default', function ($show_default, $post_id) {
    var_dump($post_id);

    return $show_default;
}, 10, 2);