this answer is for showing the description in the menu. if you want show it somewhere else, you should create a new question.
I often try to propose solutions that don’t use javascript if not necessary. but for this customisation, there is not practical hooks to do that then I think it will be no very reliable to use output buffering.
in the following code, put the slug of the CPT, the URL of the javascript file and replace MY_PLUGIN by the slug of your plugin to limit interference with other plugins.
code to put in menu.js
"use strict";
document.addEventListener("DOMContentLoaded", e => {
const menu_entry = document.querySelector(`#menu-posts-${MY_PLUGIN["cpt_slug"]} a.wp-has-submenu`);
const description = document.createElement("div");
description["textContent"] = MY_PLUGIN["description"];
description["classList"].add("cpt_description");
menu_entry.insertAdjacentElement("afterend", description);
});
loading of the javascript code
add_action("adminmenu", function () {
wp_enqueue_script(
"MY_PLUGIN/menu"
, "menu.js" // URL of the file
, []
, 123 // version of the file menu.js
);
$cpt_slug = "tache_et_procedure"; // CPT slug to correct here
$obj = get_post_type_object($cpt_slug);
wp_localize_script(
"MY_PLUGIN/menu"
, "MY_PLUGIN"
, [
"cpt_slug" => $cpt_slug,
"description" => $obj->description,
]
);
});