Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude ACF sub_page #83

Open
Loosie94 opened this issue Apr 4, 2023 · 1 comment
Open

Exclude ACF sub_page #83

Loosie94 opened this issue Apr 4, 2023 · 1 comment

Comments

@Loosie94
Copy link

Loosie94 commented Apr 4, 2023

Version information

  • Plugin version : 1.1.10
  • PHP : 8
  • WordPress : 6.2
  • ACF version :
  • Polylang version :

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
Copy link

PtrLarsson commented May 29, 2024

@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);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants