admin管理员组

文章数量:1122846

I want to use pods custom fields inside a page and i would like the pods editor to appear only if the page is using a specific page template, for exemple if the page is using my galerie.php template

I can't find a way to do it and at this point im not sure if it's even possible.

i'm using :

  • wordpress 6.2.2
  • Pods 2.9
  • A child theme of 2021

I want to use pods custom fields inside a page and i would like the pods editor to appear only if the page is using a specific page template, for exemple if the page is using my galerie.php template

I can't find a way to do it and at this point im not sure if it's even possible.

i'm using :

  • wordpress 6.2.2
  • Pods 2.9
  • A child theme of 2021
Share Improve this question asked Jul 30, 2023 at 19:01 EngixEngix 1
Add a comment  | 

1 Answer 1

Reset to default 1

This will remove the meta box for a Pods field group called 'More Fields' from the editor for a page not using a certain page template:

// remove meta box if page does not use a certain page template
add_action('admin_head', function() {
    $template = get_page_template_slug(get_queried_object_id());
    if('my-page-template.php' !== $template) {
        remove_meta_box('pods-meta-more-fields', 'page', 'normal');
    }
});

本文标签: Show Pods Custom Fields Editor when a page is using a specific template in WordPress