There has been a major misunderstanding of child themes. Parent and child themes are a WordPress feature, not a PHP feature, and include
is a PHP directive, not a WordPress function.
To make the distinction and reason clearer child themes don’t inherit a parents “files” they inherit the parents “templates”.
So include "inc/duplicate-posts.php";
will always be relative to the current file that’s calling it, not the root of the current theme, and it will never look in the parent theme.
Instead, it looks like there’s been a misunderstanding about how templates are meant to be loaded in WordPress.
This loads a template file in your theme:
get_template_part( 'template', 'file' );
It will load the first file in this list that it can find:
template-file.php
in the child themetemplate-file.php
in the parent themetemplate.php
in the child themetemplate.php
in the parent theme
Always use get_template_part
for templates, files that render HTML. These can be overloaded/replaced via child themes.
Never use get_template_part
for library files or files that define classes and functions, e.g. your includes
folder. Always use include
/include_once
/require
/require_once
for arbitrary PHP files that declare hooks/functions/classes, libraries etc.