{"id":79,"date":"2025-09-22T18:27:56","date_gmt":"2025-09-22T18:27:56","guid":{"rendered":"https:\/\/maxpertici.fr\/fr\/?p=79"},"modified":"2025-09-30T09:41:04","modified_gmt":"2025-09-30T09:41:04","slug":"hook-to-the-future","status":"publish","type":"post","link":"https:\/\/maxpertici.fr\/fr\/blog\/notes\/hook-to-the-future\/","title":{"rendered":"Hook To The Future"},"content":{"rendered":"\n<p class=\"has-text-align-right\" style=\"font-size:12px\">FR | <a href=\"https:\/\/maxpertici.fr\/blog\/notes\/hook-to-the-future\/\">EN<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading has-large-font-size\">Introduction<\/h2>\n\n\n\n<p>Les hooks sont omnipr\u00e9sents dans WordPress. Au d\u00e9but, \u00e0 chaque \u00e9tape, dans les fonctions, autour des donn\u00e9es, et jusqu\u2019\u00e0 la fin du cycle d\u2019ex\u00e9cution. Ils font partie int\u00e9grante de l\u2019architecture du CMS. Ils sont des centaines, et de nouveaux apparaissent r\u00e9guli\u00e8rement.<\/p>\n\n\n\n<p>Les hooks offrent une flexibilit\u00e9 immense au c\u0153ur de WordPress. Et en cr\u00e9ant les v\u00f4tres, vous donnez \u00e0 votre propre code cette m\u00eame capacit\u00e9 d\u2019adaptation.<\/p>\n\n\n\n<p>Un code vivant et pilotable. Un code qui s\u2019adapte au pr\u00e9sent et peut m\u00eame, parfois, changer le futur.<\/p>\n\n\n\n<div style=\"height:var(--wp--preset--spacing--20)\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading has-large-font-size\">Concept<\/h2>\n\n\n\n<p>Un <a href=\"https:\/\/developer.wordpress.org\/plugins\/hooks\/\" target=\"_blank\" rel=\"noreferrer noopener\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-custom-vert-color\">hook<\/mark><\/a> (crochet) est un point d\u2019accroche que WordPress met \u00e0 disposition pour que les d\u00e9veloppeurs puissent ajouter ou modifier des fonctionnalit\u00e9s sans toucher au c\u0153ur du CMS.<\/p>\n\n\n\n<p>Il en existe deux types principaux :<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Actions<\/strong> : pour ex\u00e9cuter du code \u00e0 un moment pr\u00e9cis,<\/li>\n\n\n\n<li><strong>Filters<\/strong> : pour modifier des donn\u00e9es avant qu\u2019elles ne soient utilis\u00e9es ou affich\u00e9es.<\/li>\n<\/ul>\n\n\n\n<p>Les hooks sont comme des points de montage pr\u00e9vus dans le moteur : ils permettent de greffer ses propres pi\u00e8ces sans d\u00e9monter l\u2019ensemble. Ils permettent donc de brancher son propre code au noyau de WordPress, mais aussi \u00e0 l&rsquo;ensemble des extensions et theme qui en proposent.<\/p>\n\n\n\n<div style=\"height:var(--wp--preset--spacing--20)\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading has-large-font-size\">Ordre<\/h2>\n\n\n\n<p>Les hooks s\u2019encha\u00eenent et se succ\u00e8dent jusqu&rsquo;au <code><a href=\"https:\/\/developer.wordpress.org\/reference\/hooks\/shutdown\/\" target=\"_blank\" rel=\"noreferrer noopener\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-custom-vert-color\">shutdown<\/mark><\/a><\/code>.<\/p>\n\n\n\n<p>L&rsquo;ordre d\u2019ex\u00e9cution a toute son importance. Comprendre cette s\u00e9quence est essentiel : un <code><a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/add_action\/\" target=\"_blank\" rel=\"noreferrer noopener\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-custom-vert-color\">add_action()<\/mark><\/a><\/code> ou <code><a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/add_filter\/\" target=\"_blank\" rel=\"noreferrer noopener\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-custom-vert-color\">add_filter()<\/mark><\/a><\/code> trop t\u00f4t ou trop tard, et votre code n&rsquo;atteindra pas son objectif.<\/p>\n\n\n\n<p>Vous pouvez consulter <a href=\"https:\/\/developer.wordpress.org\/apis\/hooks\/action-reference\/\" target=\"_blank\" rel=\"noreferrer noopener\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-custom-vert-color\">le r\u00e9f\u00e9rentiel des actions disponibles<\/mark><\/a>. La premi\u00e8re partie de la page propose un aper\u00e7u de la s\u00e9quence de chargement de <code>muplugins_loaded<\/code> \u00e0 <code>shutdown<\/code>. Le m\u00eame r\u00e9f\u00e9rentiel existe aussi pour les <a href=\"https:\/\/developer.wordpress.org\/apis\/hooks\/filter-reference\/\" target=\"_blank\" rel=\"noreferrer noopener\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-custom-vert-color\">filtres<\/mark><\/a>.<\/p>\n\n\n\n<p><a href=\"https:\/\/www.rarst.net\/wordpress\/wordpress-core-load\" target=\"_blank\" rel=\"noreferrer noopener\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-custom-vert-color\">Comprendre le chargement du c\u0153ur de WordPress \u2013 Rarst.net<\/mark><\/a><\/p>\n\n\n\n<div style=\"height:var(--wp--preset--spacing--20)\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading has-large-font-size\">Contextes<\/h2>\n\n\n\n<p>Un m\u00eame hook peut appara\u00eetre dans plusieurs contextes.<\/p>\n\n\n\n<p>Un hook n\u2019est jamais intrins\u00e8quement \u201ctrop t\u00f4t\u201d ou \u201ctrop tard\u201d : sa pertinence d\u00e9pend uniquement de ce que vous souhaitez accomplir.<\/p>\n\n\n\n<p>Le v\u00e9ritable secret est de toujours se demander : \u00ab\u202fDans quel contexte ce hook est-il ex\u00e9cut\u00e9\u202f?\u202f\u00bb<\/p>\n\n\n\n<p>Ainsi, un hook n\u2019est \u201ctrop t\u00f4t\u201d ou \u201ctrop tard\u201d que par rapport \u00e0 un contexte sp\u00e9cifique, jamais de mani\u00e8re absolue.<\/p>\n\n\n\n<p>Quelques exemples pour illustrer :<\/p>\n\n\n\n<div style=\"height:var(--wp--preset--spacing--20)\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-columns alignwide is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<p><strong>after_setup_theme ou template_redirect<\/strong> :<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/developer.wordpress.org\/reference\/hooks\/after_setup_theme\/\" target=\"_blank\" rel=\"noreferrer noopener\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-custom-vert-color\">after_setup_theme<\/mark><\/a> se d\u00e9clenche apr\u00e8s le chargement du theme.<br>Il intervient tr\u00e8s t\u00f4t, utile si vous voulez enregistrer des fonctionnalit\u00e9s de theme (supports, menus, images, etc.).<\/li>\n\n\n\n<li><a href=\"https:\/\/developer.wordpress.org\/reference\/hooks\/template_redirect\/\" target=\"_blank\" rel=\"noreferrer noopener\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-custom-vert-color\">template_redirect<\/mark><\/a> se d\u00e9clenche avant de d\u00e9terminer quel template charger.<br>Celui-ci ne se d\u00e9clenche qu\u2019une fois que WordPress a r\u00e9solu quel template va \u00eatre utilis\u00e9 : c\u2019est le moment id\u00e9al pour rediriger un utilisateur avant l\u2019affichage.<\/li>\n\n\n\n<li>Ici donc, utiliser <strong>template_redirect<\/strong> pour enregistrer un support de theme serait \u201ctrop tard\u201d, et utiliser <strong>after_setup_theme<\/strong> pour rediriger serait \u201ctrop t\u00f4t\u201d. La main query ne serait pas encore ex\u00e9cut\u00e9e.<\/li>\n<\/ul>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<p><strong>admin_init :<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/developer.wordpress.org\/reference\/hooks\/admin_init\/\" target=\"_blank\" rel=\"noreferrer noopener\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-custom-vert-color\">admin_init<\/mark><\/a> se d\u00e9clenche lors de l&rsquo;initialisation d&rsquo;une page d&rsquo;administration ou d&rsquo;un script.<\/li>\n\n\n\n<li>Cela signifie que ce m\u00eame hook est partag\u00e9 par plusieurs contextes (toutes les pages de l\u2019admin).<\/li>\n\n\n\n<li>Si vous voulez cibler uniquement une page particuli\u00e8re (par ex. la page d\u2019options d\u2019un plugin), vous devez ajouter un test de contexte.<\/li>\n\n\n\n<li>Ici, le hook n\u2019est pas \u201ctrop t\u00f4t\u201d ni \u201ctrop tard\u201d en soi : il est simplement partag\u00e9 par tous les \u00e9crans, et c\u2019est \u00e0 vous de valider le contexte.<\/li>\n<\/ul>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<p><strong>pre_get_posts :<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Le hook <a href=\"https:\/\/developer.wordpress.org\/reference\/hooks\/pre_get_posts\/\" target=\"_blank\" rel=\"noreferrer noopener\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-custom-vert-color\">pre_get_posts<\/mark><\/a> se d\u00e9clenche avant l\u2019ex\u00e9cution de chaque requ\u00eate <code>WP_Query<\/code>.<\/li>\n\n\n\n<li>Ce hook est impl\u00e9ment\u00e9 dans la m\u00e9thode <code><a href=\"https:\/\/github.com\/WordPress\/wordpress-develop\/blob\/6.8.2\/src\/wp-includes\/class-wp-query.php#L1910-L1910\" target=\"_blank\" rel=\"noreferrer noopener\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-custom-vert-color\">get_posts()<\/mark><\/a><\/code> de la classe <code>WP_Query<\/code>.<br>Il est donc ex\u00e9cut\u00e9 \u00e0 chaque ex\u00e9cution de cette m\u00e9thode, c\u2019est-\u00e0-dire \u00e0 chaque r\u00e9cup\u00e9ration de posts via <code>WP_Query<\/code>.<\/li>\n\n\n\n<li>Cela inclut la requ\u00eate principale (main query), mais aussi toutes les requ\u00eates secondaires qui peuvent \u00eatre g\u00e9n\u00e9r\u00e9es par des widgets, des menus ou des appels \u00e0 <code>WP_Query<\/code>. Si vous souhaitez manipuler uniquement la requ\u00eate principale, il est indispensable de tester le contexte (via <a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/is_main_query\/\" target=\"_blank\" rel=\"noreferrer noopener\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-custom-vert-color\">is_main_query()<\/mark><\/a>, notamment).<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n\n\n\n<div style=\"height:var(--wp--preset--spacing--20)\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading has-large-font-size\">Timing<\/h2>\n\n\n\n<p>Pour utiliser un hook, il est indispensable d&rsquo;attacher votre callback \u00e0 un hook avant son ex\u00e9cution bien s\u00fbr. Sinon, cela ne peut pas fonctionner, vous vous en doutez bien. Autrement dit, tant qu\u2019un hook n\u2019a pas encore \u00e9t\u00e9 ex\u00e9cut\u00e9, vous pouvez toujours vous y accrocher ou pr\u00e9parer une intervention sur le suivant.<\/p>\n\n\n\n<p style=\"margin-top:var(--wp--preset--spacing--20)\">Vous pouvez donc vous appuyer sur un hook pour v\u00e9rifier une donn\u00e9e ou un contexte et envisager des actions futures sur les hooks \u00e0 venir.<\/p>\n\n\n\n<p>Il est possible d\u2019enregistrer un callback de mani\u00e8re dynamique, \u00e0 la vol\u00e9e, avant l\u2019ex\u00e9cution du hook cible, en tenant compte du contexte et en choisissant le moment opportun.<\/p>\n\n\n\n<p>Ma\u00eetriser le moment d\u2019attachement, c\u2019est ma\u00eetriser le flux et les comportements.<\/p>\n\n\n\n<div style=\"height:24px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading has-large-font-size\">Bifurcations<\/h2>\n\n\n\n<p><br>Un hook est une occasion de modifier ou d\u2019enrichir une donn\u00e9e avant son utilisation : la r\u00e9\u00e9crire, la d\u00e9tourner ou l\u2019adapter selon le contexte, l\u2019utilisateur ou le moment. C\u2019est une passerelle entre ce qui aurait d\u00fb \u00eatre\u2026 et ce qui sera.<\/p>\n\n\n\n<p>Chaque <code><a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/do_action\/\" target=\"_blank\" rel=\"noreferrer noopener\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-custom-vert-color\">do_action()<\/mark><\/a><\/code> ou <code><a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/apply_filters\/\" target=\"_blank\" rel=\"noreferrer noopener\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-custom-vert-color\">apply_filters()<\/mark><\/a><\/code> est un point cl\u00e9 sur la timeline de WordPress : comprendre ces hooks, c\u2019est savoir quand et comment agir pour faire \u00e9voluer le flux des donn\u00e9es.<\/p>\n\n\n\n<p>Attacher un comportement, injecter une logique, modifier une valeur : ma\u00eetriser les hooks, c&rsquo;est <strong>le pouvoir de changer le futur de votre application<\/strong>.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Les hooks sont omnipr\u00e9sents dans WordPress. Au d\u00e9but, \u00e0 chaque \u00e9tape, dans les fonctions, autour des donn\u00e9es, et jusqu\u2019\u00e0 la fin du cycle d\u2019ex\u00e9cution. Ils font partie int\u00e9grante de l\u2019architecture du CMS<\/p>\n","protected":false},"author":1,"featured_media":339,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-79","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-notes"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Hook To The Future - @maxpertici<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/maxpertici.fr\/fr\/blog\/notes\/hook-to-the-future\/\" \/>\n<meta property=\"og:locale\" content=\"fr_FR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Hook To The Future - @maxpertici\" \/>\n<meta property=\"og:description\" content=\"Les hooks sont omnipr\u00e9sents dans WordPress. Au d\u00e9but, \u00e0 chaque \u00e9tape, dans les fonctions, autour des donn\u00e9es, et jusqu\u2019\u00e0 la fin du cycle d\u2019ex\u00e9cution. Ils font partie int\u00e9grante de l\u2019architecture du CMS\" \/>\n<meta property=\"og:url\" content=\"https:\/\/maxpertici.fr\/fr\/blog\/notes\/hook-to-the-future\/\" \/>\n<meta property=\"og:site_name\" content=\"@maxpertici\" \/>\n<meta property=\"article:published_time\" content=\"2025-09-22T18:27:56+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-09-30T09:41:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/maxpertici.fr\/fr\/wp-content\/uploads\/sites\/3\/2025\/09\/og-hook-to-the-future.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1438\" \/>\n\t<meta property=\"og:image:height\" content=\"806\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Max\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u00c9crit par\" \/>\n\t<meta name=\"twitter:data1\" content=\"Max\" \/>\n\t<meta name=\"twitter:label2\" content=\"Dur\u00e9e de lecture estim\u00e9e\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/maxpertici.fr\\\/fr\\\/blog\\\/notes\\\/hook-to-the-future\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/maxpertici.fr\\\/fr\\\/blog\\\/notes\\\/hook-to-the-future\\\/\"},\"author\":{\"name\":\"Max\",\"@id\":\"https:\\\/\\\/maxpertici.fr\\\/fr\\\/#\\\/schema\\\/person\\\/33f79b1589673a71ca8e9d489e3b4d6a\"},\"headline\":\"Hook To The Future\",\"datePublished\":\"2025-09-22T18:27:56+00:00\",\"dateModified\":\"2025-09-30T09:41:04+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/maxpertici.fr\\\/fr\\\/blog\\\/notes\\\/hook-to-the-future\\\/\"},\"wordCount\":936,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/maxpertici.fr\\\/fr\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/maxpertici.fr\\\/fr\\\/blog\\\/notes\\\/hook-to-the-future\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/maxpertici.fr\\\/fr\\\/wp-content\\\/uploads\\\/sites\\\/3\\\/2025\\\/09\\\/jared-murray-NSuufgf-BME-unsplash-scaled.jpg\",\"articleSection\":[\"Notes\"],\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/maxpertici.fr\\\/fr\\\/blog\\\/notes\\\/hook-to-the-future\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/maxpertici.fr\\\/fr\\\/blog\\\/notes\\\/hook-to-the-future\\\/\",\"url\":\"https:\\\/\\\/maxpertici.fr\\\/fr\\\/blog\\\/notes\\\/hook-to-the-future\\\/\",\"name\":\"Hook To The Future - @maxpertici\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/maxpertici.fr\\\/fr\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/maxpertici.fr\\\/fr\\\/blog\\\/notes\\\/hook-to-the-future\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/maxpertici.fr\\\/fr\\\/blog\\\/notes\\\/hook-to-the-future\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/maxpertici.fr\\\/fr\\\/wp-content\\\/uploads\\\/sites\\\/3\\\/2025\\\/09\\\/jared-murray-NSuufgf-BME-unsplash-scaled.jpg\",\"datePublished\":\"2025-09-22T18:27:56+00:00\",\"dateModified\":\"2025-09-30T09:41:04+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/maxpertici.fr\\\/fr\\\/blog\\\/notes\\\/hook-to-the-future\\\/#breadcrumb\"},\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/maxpertici.fr\\\/fr\\\/blog\\\/notes\\\/hook-to-the-future\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\\\/\\\/maxpertici.fr\\\/fr\\\/blog\\\/notes\\\/hook-to-the-future\\\/#primaryimage\",\"url\":\"https:\\\/\\\/maxpertici.fr\\\/fr\\\/wp-content\\\/uploads\\\/sites\\\/3\\\/2025\\\/09\\\/jared-murray-NSuufgf-BME-unsplash-scaled.jpg\",\"contentUrl\":\"https:\\\/\\\/maxpertici.fr\\\/fr\\\/wp-content\\\/uploads\\\/sites\\\/3\\\/2025\\\/09\\\/jared-murray-NSuufgf-BME-unsplash-scaled.jpg\",\"width\":2560,\"height\":2048},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/maxpertici.fr\\\/fr\\\/blog\\\/notes\\\/hook-to-the-future\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\\\/\\\/maxpertici.fr\\\/fr\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Notes\",\"item\":\"https:\\\/\\\/maxpertici.fr\\\/fr\\\/cat\\\/notes\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Hook To The Future\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/maxpertici.fr\\\/fr\\\/#website\",\"url\":\"https:\\\/\\\/maxpertici.fr\\\/fr\\\/\",\"name\":\"@maxpertici\",\"description\":\"D\u00e9veloppeur WordPress\",\"publisher\":{\"@id\":\"https:\\\/\\\/maxpertici.fr\\\/fr\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/maxpertici.fr\\\/fr\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"fr-FR\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/maxpertici.fr\\\/fr\\\/#organization\",\"name\":\"@maxpertici\",\"url\":\"https:\\\/\\\/maxpertici.fr\\\/fr\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\\\/\\\/maxpertici.fr\\\/fr\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/maxpertici.fr\\\/fr\\\/wp-content\\\/uploads\\\/sites\\\/3\\\/2026\\\/03\\\/1630568236441.jpeg\",\"contentUrl\":\"https:\\\/\\\/maxpertici.fr\\\/fr\\\/wp-content\\\/uploads\\\/sites\\\/3\\\/2026\\\/03\\\/1630568236441.jpeg\",\"width\":200,\"height\":200,\"caption\":\"@maxpertici\"},\"image\":{\"@id\":\"https:\\\/\\\/maxpertici.fr\\\/fr\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/maxpertici.fr\\\/fr\\\/#\\\/schema\\\/person\\\/33f79b1589673a71ca8e9d489e3b4d6a\",\"name\":\"Max\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ed0ec4f2da112567c22bba05ac82ed103d4313610b7008eacec81ef0a5298012?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ed0ec4f2da112567c22bba05ac82ed103d4313610b7008eacec81ef0a5298012?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ed0ec4f2da112567c22bba05ac82ed103d4313610b7008eacec81ef0a5298012?s=96&d=mm&r=g\",\"caption\":\"Max\"},\"sameAs\":[\"https:\\\/\\\/maxpertici.fr\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Hook To The Future - @maxpertici","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/maxpertici.fr\/fr\/blog\/notes\/hook-to-the-future\/","og_locale":"fr_FR","og_type":"article","og_title":"Hook To The Future - @maxpertici","og_description":"Les hooks sont omnipr\u00e9sents dans WordPress. Au d\u00e9but, \u00e0 chaque \u00e9tape, dans les fonctions, autour des donn\u00e9es, et jusqu\u2019\u00e0 la fin du cycle d\u2019ex\u00e9cution. Ils font partie int\u00e9grante de l\u2019architecture du CMS","og_url":"https:\/\/maxpertici.fr\/fr\/blog\/notes\/hook-to-the-future\/","og_site_name":"@maxpertici","article_published_time":"2025-09-22T18:27:56+00:00","article_modified_time":"2025-09-30T09:41:04+00:00","og_image":[{"width":1438,"height":806,"url":"https:\/\/maxpertici.fr\/fr\/wp-content\/uploads\/sites\/3\/2025\/09\/og-hook-to-the-future.png","type":"image\/png"}],"author":"Max","twitter_card":"summary_large_image","twitter_misc":{"\u00c9crit par":"Max","Dur\u00e9e de lecture estim\u00e9e":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/maxpertici.fr\/fr\/blog\/notes\/hook-to-the-future\/#article","isPartOf":{"@id":"https:\/\/maxpertici.fr\/fr\/blog\/notes\/hook-to-the-future\/"},"author":{"name":"Max","@id":"https:\/\/maxpertici.fr\/fr\/#\/schema\/person\/33f79b1589673a71ca8e9d489e3b4d6a"},"headline":"Hook To The Future","datePublished":"2025-09-22T18:27:56+00:00","dateModified":"2025-09-30T09:41:04+00:00","mainEntityOfPage":{"@id":"https:\/\/maxpertici.fr\/fr\/blog\/notes\/hook-to-the-future\/"},"wordCount":936,"commentCount":0,"publisher":{"@id":"https:\/\/maxpertici.fr\/fr\/#organization"},"image":{"@id":"https:\/\/maxpertici.fr\/fr\/blog\/notes\/hook-to-the-future\/#primaryimage"},"thumbnailUrl":"https:\/\/maxpertici.fr\/fr\/wp-content\/uploads\/sites\/3\/2025\/09\/jared-murray-NSuufgf-BME-unsplash-scaled.jpg","articleSection":["Notes"],"inLanguage":"fr-FR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/maxpertici.fr\/fr\/blog\/notes\/hook-to-the-future\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/maxpertici.fr\/fr\/blog\/notes\/hook-to-the-future\/","url":"https:\/\/maxpertici.fr\/fr\/blog\/notes\/hook-to-the-future\/","name":"Hook To The Future - @maxpertici","isPartOf":{"@id":"https:\/\/maxpertici.fr\/fr\/#website"},"primaryImageOfPage":{"@id":"https:\/\/maxpertici.fr\/fr\/blog\/notes\/hook-to-the-future\/#primaryimage"},"image":{"@id":"https:\/\/maxpertici.fr\/fr\/blog\/notes\/hook-to-the-future\/#primaryimage"},"thumbnailUrl":"https:\/\/maxpertici.fr\/fr\/wp-content\/uploads\/sites\/3\/2025\/09\/jared-murray-NSuufgf-BME-unsplash-scaled.jpg","datePublished":"2025-09-22T18:27:56+00:00","dateModified":"2025-09-30T09:41:04+00:00","breadcrumb":{"@id":"https:\/\/maxpertici.fr\/fr\/blog\/notes\/hook-to-the-future\/#breadcrumb"},"inLanguage":"fr-FR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/maxpertici.fr\/fr\/blog\/notes\/hook-to-the-future\/"]}]},{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/maxpertici.fr\/fr\/blog\/notes\/hook-to-the-future\/#primaryimage","url":"https:\/\/maxpertici.fr\/fr\/wp-content\/uploads\/sites\/3\/2025\/09\/jared-murray-NSuufgf-BME-unsplash-scaled.jpg","contentUrl":"https:\/\/maxpertici.fr\/fr\/wp-content\/uploads\/sites\/3\/2025\/09\/jared-murray-NSuufgf-BME-unsplash-scaled.jpg","width":2560,"height":2048},{"@type":"BreadcrumbList","@id":"https:\/\/maxpertici.fr\/fr\/blog\/notes\/hook-to-the-future\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/maxpertici.fr\/fr\/"},{"@type":"ListItem","position":2,"name":"Notes","item":"https:\/\/maxpertici.fr\/fr\/cat\/notes\/"},{"@type":"ListItem","position":3,"name":"Hook To The Future"}]},{"@type":"WebSite","@id":"https:\/\/maxpertici.fr\/fr\/#website","url":"https:\/\/maxpertici.fr\/fr\/","name":"@maxpertici","description":"D\u00e9veloppeur WordPress","publisher":{"@id":"https:\/\/maxpertici.fr\/fr\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/maxpertici.fr\/fr\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"fr-FR"},{"@type":"Organization","@id":"https:\/\/maxpertici.fr\/fr\/#organization","name":"@maxpertici","url":"https:\/\/maxpertici.fr\/fr\/","logo":{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/maxpertici.fr\/fr\/#\/schema\/logo\/image\/","url":"https:\/\/maxpertici.fr\/fr\/wp-content\/uploads\/sites\/3\/2026\/03\/1630568236441.jpeg","contentUrl":"https:\/\/maxpertici.fr\/fr\/wp-content\/uploads\/sites\/3\/2026\/03\/1630568236441.jpeg","width":200,"height":200,"caption":"@maxpertici"},"image":{"@id":"https:\/\/maxpertici.fr\/fr\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/maxpertici.fr\/fr\/#\/schema\/person\/33f79b1589673a71ca8e9d489e3b4d6a","name":"Max","image":{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/secure.gravatar.com\/avatar\/ed0ec4f2da112567c22bba05ac82ed103d4313610b7008eacec81ef0a5298012?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/ed0ec4f2da112567c22bba05ac82ed103d4313610b7008eacec81ef0a5298012?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ed0ec4f2da112567c22bba05ac82ed103d4313610b7008eacec81ef0a5298012?s=96&d=mm&r=g","caption":"Max"},"sameAs":["https:\/\/maxpertici.fr"]}]}},"_links":{"self":[{"href":"https:\/\/maxpertici.fr\/fr\/wp-json\/wp\/v2\/posts\/79","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/maxpertici.fr\/fr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/maxpertici.fr\/fr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/maxpertici.fr\/fr\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/maxpertici.fr\/fr\/wp-json\/wp\/v2\/comments?post=79"}],"version-history":[{"count":126,"href":"https:\/\/maxpertici.fr\/fr\/wp-json\/wp\/v2\/posts\/79\/revisions"}],"predecessor-version":[{"id":391,"href":"https:\/\/maxpertici.fr\/fr\/wp-json\/wp\/v2\/posts\/79\/revisions\/391"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/maxpertici.fr\/fr\/wp-json\/wp\/v2\/media\/339"}],"wp:attachment":[{"href":"https:\/\/maxpertici.fr\/fr\/wp-json\/wp\/v2\/media?parent=79"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/maxpertici.fr\/fr\/wp-json\/wp\/v2\/categories?post=79"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/maxpertici.fr\/fr\/wp-json\/wp\/v2\/tags?post=79"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}