How to add an attribute data-slug = “$specfic_page_slug” in WordPress menu item?

It would be easier to add this on a menu link. The attributes for each link pass through the nav_menu_link_attributes filter.

You should be able to use it to add a custom one, along the lines of (not tested):

add_filter( 'nav_menu_link_attributes', function( $atts, $item ) {

 // check if $item is what you need

 $atts['data-slug'] = 'something';

 return $atts'

}, 10, 2);

To change the whole list items you would have to use more general walker_nav_menu_start_el filter, which only passes string you would have to cut up more messily.

tech