• Hello!

    I was trying to limit the depth of my parent pages list with this code:

    function my_test($args) {
        global $post_type_object;
    
        if ( $post_type_object->name == 'my_custom_post_type') {
            $args['depth'] = 1;
        }
        return $args;
    }
    add_filter('page_attributes_dropdown_pages_args','my_test');
    add_filter('quick_edit_dropdown_pages_args', 'my_test');

    I have a specific custom post type where I need to be able to control the contents of the dropdown, and your plugin is preventing me from doing this. Unfortunately it seems to fail because the plugin is overriding the wp_dropdown_pages filter, seen in PrivatePostParent.php line 13.
    If this code and filter only should be used when calling wp_dropdown_pages from within the plugin itself I would recommend passing a unique argument which you can check for in the function metabox, otherwise this will conflict with any other usages of dropdown pages.
    Another approach is to actually check for post types that should be used by the plugin so this functionality isn’t overwritten on post types that have nested pages deactivated.

    Best Regards

  • The topic ‘Unable to make changes to WP core filters’ is closed to new replies.