Manually adding current_page_parent to wp_list_pages()

By default wp_list_pages() uses the Walker_Page class to create the HTML list, and there’s a filter in there—page_css_class—for the CSS classes.

You should be able to do something like this:

/**
 * Filters the CSS classes.
 *
 * @param  array   $css_class    The current CSS classes. Array of strings.
 * @param  WP_Post $page         The current page object.
 * @param  int     $depth        Depth of the page.
 * @param  array   $args         Array of arguments.
 * @param  int     $current_page ID of the current page.
 * @return array                 The filtered array of classes.
 */
function wpse_378686_page_classes( $css_class, $page, $depth, $args, $current_page ) {
    if ( is_singular( 'work' ) && 1703 == $page->ID ) {
        $css_class[] = 'current_page_parent';
    }
    return $css_class;
}
add_filter( 'page_css_class', 'wpse_378686_page_classes', 10, 5 );

Add that code snippet to your active theme’s functions.php file, or to a plugin that you would then activate.

Notes

  • is_singular( 'work' ) should be true on any single work custom post.
  • I’ve changed the code to use $page->ID instead of $current_page, as I think the $page variable contains the page that the page list is currently processing.

(Edited to reflect the comment re: page ID 1714. Edited again after clarification in the comments (and a change to page ID 1703 instead of 1714).)