Wordpressã®ããã¯ãšãã®äœ¿çšæ¹æ³ã«ã€ããŠã www.wprecipes.comã®ææè ã§ãããã«ã®ãŒã®è¥ãWordpresså°é家ã«ããèšäºã
ã¯ããã«
ããã¯ã¯ãWordpressã®éåžžã«äŸ¿å©ãªæ©èœã§ãã ãŠãŒã¶ãŒå®çŸ©é¢æ°ãæ¢åã®é¢æ°ã®ãããã¯ãã«ãããã¯ãã§ããããããšã³ãžã³ã³ã¢ãã¡ã€ã«ãå€æŽããã«Wordpressã®æ©èœãå€æŽã§ããŸãã ãã®èšäºã§ã¯ãWordpressã®10ã®ç¹ã«äŸ¿å©ãªãããã«äœ¿ããããã¯ãšããã®ãœãŒã¹ã³ãŒãã®äŸãšèª¬æã玹ä»ããŸãã
ããã¯ãšã¯ïŒ
ç¹å®ã®å¹æãåŸãã«ã¯ãWordpressã®åäœæ¹æ³ããããã«å€æŽããå¿ èŠããããŸãã éçºè ãã«ãŒãã«ãã¡ã€ã«ãšåŒãã ãã¡ã€ã«ã«ããã€ãã®å€æŽãå ããå¿ èŠããããŸãâ Wordpressãæ£ããæ©èœããããã«å¿ èŠã§ãã
ãã ããã«ãŒãã«ãã¡ã€ã«ãå€æŽããããšã¯æªãèãã§ããããã«ãããããã°ã«ã»ãã¥ãªãã£ããŒã«ãçããå¯èœæ§ããããŸãã ãŸãããšã³ãžã³ãæ°ããããŒãžã§ã³ã«ã¢ããã°ã¬ãŒããããšããã«ããã¹ãŠã®å€æŽãæ¶ããŸãã
ãã ããæ¡åŒµæ©èœã¯äŸç¶ãšããŠå¿ èŠã§ãã ãããè¡ãããã«ãéçºè ã¯ãã©ã°ã€ã³APIãçºæããŸããã
ããã¯ã¯ããã©ã°ã€ã³ãæ§ç¯ããããã®äž»èŠãªãããã¯ã®1ã€ã§ãã ã»ãšãã©ãã¹ãŠã®ãã©ã°ã€ã³ã¯ããã¯ã䜿çšããŠWordpressã®æ©èœãæ¡åŒµããŸãã
ããã°ã§ããã¯ã䜿çšããæ¹æ³
ãã©ã°ã€ã³ãäœæãããŸã§ã functions.phpãã¡ã€ã«ã«ããã¯ãäœæããå¿ èŠããããŸãã ãã®ãã¡ã€ã«ã¯wp-content / themes / yourthemeãã£ã¬ã¯ããªãŒã«ãããŸã ïŒ / yourthemeã¯çŸåšã®ããŒãã眮ãããŠãããã£ã¬ã¯ããªãŒã§ãïŒã
ã«ã¹ã¿ã é¢æ°ããšã³ãžã³ã³ã¢é¢æ°ã«æ¥ç¶ããæ¹æ³ã瀺ãäŸã次ã«ç€ºããŸãã
- add_action ïŒ 'publish_post' ã 'myCustomFunction' ïŒ ;
ãã®äŸã§ã¯ããŠãŒã¶ãŒå®çŸ©é¢æ°myCustomFunctionïŒïŒãpublish_postïŒïŒã«ãŒãã«é¢æ°ã«æ¥ç¶ããŸããã myCustomFunctionïŒïŒé¢æ°ã¯ã publish_postïŒïŒé¢æ°ãå®è¡ããããã³ã«å®è¡ãããŸãã
ãã¡ããã remove_actionïŒïŒé¢æ°ã䜿çšããŠããã¯ãåé€ããããšãã§ããŸãã
- remove_action ïŒ 'publish_post' ã 'myCustomFunction' ïŒ ;
1. WordPressã§ã®èªåãã©ãŒãããã®ç¡å¹å
åé¡ã
Wordpressã®ã¿ã€ãã°ã©ãã¡ãŒãããã©ã«ãã§ãçŽæ¥ãåŒçšç¬Šããæ²ç·ãã«å€ããæçš¿ã®æžåŒèšå®ã«ãã®ä»ã®å°ããªå€æŽãå ããããšã«ãæ°ã¥ãã§ãããã
ããã¯ãããã¬ãŒãéåžžã®ã³ã³ãã³ããæçš¿ããå Žåã«é©ããŠããŸãïŒãã¬ãŒã³ããã¹ããšç»åãæ瀺ãããŠããŸãïŒã ããããåŸã§è°è«ããããã«ãœãŒã¹ã³ãŒããæçš¿ãã人ãããããããã®ãæ²ãã£ããåŒçšã®ããã«ãã€ã³ã¿ããªã¿ãŸãã¯ã³ã³ãã€ã©ãæ§æãšã©ãŒã«é¢ããã¡ãã»ãŒãžãäžãããšã圌ãã¯éåžžã«äžå¹žã«ãªããŸãã
解決çã
次ã®ã³ãŒããfunctions.phpãã¡ã€ã«ã«è²Œãä»ããã ãã§ãã
- function my_formatter ïŒ $ content ïŒ {
- $ new_content = '' ;
- $ pattern_full = '{ïŒ\ [raw \]ã*ïŒ\ [/ raw \]ïŒ} is' ;
- $ pattern_contents = '{\ [raw \]ïŒã*ïŒïŒ\ [/ raw \]} is' ;
- $ããŒã¹ = preg_split ïŒ $ pattern_full ã $ content ã -1 ã PREG_SPLIT_DELIM_CAPTURE ïŒ ;
- foreach ïŒ $ piece as $ piece ïŒ {
- if ïŒ preg_match ïŒ $ pattern_contents ã $ piece ã $ matches ïŒ ïŒïŒ {
- $ new_content ã= $㯠[ 1 ]ãš äžèŽã ãŸãã
- } else {
- $ new_content ã= wptexturize ïŒ wpautop ïŒ $ piece ïŒ ïŒ ;
- }
- }
- $ new_contentã è¿ã ãŸã ã
- }
- remove_filter ïŒ 'the_content' ã 'wpautop' ïŒ ;
- remove_filter ïŒ 'the_content' ã 'wptexturize' ïŒ ;
- add_filter ïŒ 'the_content' ã 'my_formatter' ã 99 ïŒ ;
ãããè¡ã£ãåŸãæçš¿ããã¹ããèªåçã«ãã©ãŒããããããªãããã«ã [raw]ã¿ã°ã䜿çšã§ããŸãã
[raw]This text will not be automatically formatted.[/raw]
ã³ãŒãã®èª¬æã
ãŸããæ£èŠè¡šçŸã«åºã¥ããŠãæçš¿ã®ã³ã³ãã³ãã§[raw]ã¿ã°ãèŠã€ããé¢æ°ãäœæããŸãã
次ã«ã my_formatterïŒïŒé¢æ°ãthecontentïŒïŒé¢æ°ã«ãã€ã³ãããŸãã ã€ãŸã ãé¢æ°ã¯thecontent ïŒïŒé¢æ°ãåŒã³åºããããã³ã«å®è¡ãããŸãã
èªåãã©ãŒããããç¡å¹ã«ããããã«ã remove_filterïŒïŒé¢æ°ã䜿çšããŸãã ã
2.ããã¯ã«ãã蚪åè ãã©ãŠã¶ã®æ±ºå®
åé¡ã
ãã©ãŠã¶ãŒéã®äºææ§ã¯ãWebéçºã§æãäžè¬çãªåé¡ã§ãã ããã°ã«ã¢ã¯ã»ã¹ãããŠãŒã¶ãŒã®ãã©ãŠã¶ãç¹å®ããåãã©ãŠã¶ã®bodyã¿ã°ã®CSSã¯ã©ã¹ãäœæã§ããã°ãå€ãã®ç¥çµãšæéãç¯çŽã§ããŸãã
解決çã
è€éãªããšã¯ãããŸããã次ã®ã³ãŒããfunctions.phpãã¡ã€ã«ã«è²Œãä»ããŠä¿åããŸããå®äºã§ãïŒ
- add_filter ïŒ 'body_class' ã 'browser_body_class' ïŒ ;
- é¢æ° browser_body_class ïŒ $ã¯ã©ã¹ ïŒ {
- ã°ããŒãã« $ is_lynx ã $ is_gecko ã $ is_IE ã $ is_opera ã $ is_NS4 ã $ is_safari ã $ is_chrome ã $ is_iphone ;
- if ïŒ $ is_lynx ïŒ $ classes [ ] = 'lynx' ;
- elseif ïŒ $ is_gecko ïŒ $ classes [ ] = 'gecko' ;
- elseif ïŒ $ is_opera ïŒ $ classes [ ] = 'opera' ;
- elseif ïŒ $ is_NS4 ïŒ $ classes [ ] = 'ns4' ;
- elseif ïŒ $ is_safari ïŒ $ classes [ ] = 'safari' ;
- elseif ïŒ $ is_chrome ïŒ $ classes [ ] = 'chrome' ;
- elseif ïŒ $ is_IE ïŒ $ classes [ ] = 'ie' ;
- else $ classes [ ] = 'unknown' ;
- if ïŒ $ is_iphone ïŒ $ classes [ ] = 'iphone' ;
- $ã¯ã©ã¹ã è¿ã ãŸã ã
- }
ãã¡ã€ã«ãä¿åãããšãé¢æ°ã¯bodyã¿ã°ã®ãŠãŒã¶ãŒã®ãã©ãŠã¶ãŒã«å¯Ÿå¿ããCSSã¯ã©ã¹ãèªåçã«è¿œå ããŸãã
- < body class = "ããŒã ããã°ãã°ã€ã³ãµãã¡ãª" >
ã³ãŒãã®èª¬æã
Wordpressã«ã¯ããŠãŒã¶ãŒãé©åãªãã©ãŠã¶ãŒã䜿çšããå Žåã«trueãè¿ãã°ããŒãã«å€æ°ããããŸãã ãŠãŒã¶ãŒãGoogle Chromeãã©ãŠã¶ãŒã䜿çšããŠããå Žåã $ is_chromeå€æ°ã¯trueã«ãªããŸã ã ãã®ããã browser_body_classïŒïŒé¢æ°ãäœæããŸãã ãã®åŸãWordpressé¢æ°body_classïŒïŒã«ã¢ã¿ããããŸãã
3. TinyMCEãšãã£ã¿ãŒã®ããã©ã«ãã®ããã¹ãã®å®çŸ©
åé¡ã
å€ãã®ããã¬ãŒã¯ã»ãšãã©ã®å Žåãããã°ã«åã圢åŒã䜿çšããŸãã WpRecipes.comããã°ã®æçš¿ã«ã¯ãåžžã«åãããã¹ããã³ãŒãããã®ä»ã®ããã¹ãã衚瀺ãããŸãã
ããã©ã«ãã§ããã¹ãã衚瀺ããããã«TinyMCEã«æãããšãå€ãã®æéãç¯çŽã§ããŸãã
解決çã
ãã€ãã®ããã«ã解決çã¯ããã¯ã§ãã functions.phpãã¡ã€ã«ã«ã³ãŒããã³ããŒããŠããã®åäœã確èªããŸãã
- add_filter ïŒ 'default_content' ã 'my_editor_content' ïŒ ;
- function my_editor_content ïŒ $ content ïŒ {
- $ content = "ãã®æçš¿ã楜ããã å Žåã¯ãrssãã£ãŒãã賌èªããŠãã ããã" ;
- $ã³ã³ãã³ãã è¿ã ãŸã ã
- }
ã³ãŒãã®èª¬æã
ãã®ã³ãŒãã¯åçŽã§ãããéåžžã«åŒ·åã§ãã å¿ èŠãªããã¹ããè¿ãé¢æ°ãäœæãïŒãã®äŸã§ã¯ã蚪åè ã«RSSãã£ãŒãã®è³Œèªã«ã€ããŠå°ããããã¹ããå®çŸ©ããŸãïŒããããdefaultpress__fententïŒïŒ Wordpressé¢æ°ã«æ·»ä»ããŸãã è¡ãã
4.ãã¹ãããšã«ã³ã³ãã³ããèªåçã«æ¿å ¥ãã
åé¡ã
ã»ãšãã©ã®ããã°ã«ã¯ãæçš¿ããšã«ã³ã³ãã³ãã衚瀺ããsingle.phpãã¡ã€ã«ããããŸãããåé¡ã¯ãã®ã³ã³ãã³ããRSSãã£ãŒãã«è¡šç€ºãããªãããšã§ãã ããã¯ã¯ãã®åé¡ã解決ããã®ã«åœ¹ç«ã¡ãŸãã
解決çã
ãã¹ãŠåã-次ã®ã³ãŒããfucntions.phpãã¡ã€ã«ã«ã³ããŒããã ãã§ãã
- é¢æ° insertFootNote ïŒ $ content ïŒ {
- if ïŒ ïŒ is_feed ïŒ ïŒ && ïŒ is_home ïŒ ïŒ ïŒ {
- $ content ã= "<div class = 'subscribe'>" ;
- $ content ã= "<h4>ãã®èšäºã楜ããã ãïŒ</ h4>" ;
- $ content ã= "<p> <a href='http://feeds2.feedburner.com/WpRecipes'> RSSãã£ãŒã</a>ã賌èªããã¬ã·ããèŠéãããšã¯ãããŸããïŒ</ p>" ;
- $ content ã= "</ div>" ;
- }
- $ã³ã³ãã³ãã è¿ã ãŸã ã
- }
- add_filter ïŒ 'the_content' ã 'insertFootNote' ïŒ ;
ã³ãŒãã®èª¬æã
insertFootNoteïŒïŒé¢æ°ã®æ¬è³ªã¯åçŽã§ãïŒæçš¿ã®ã³ã³ãã³ããä¿åãã$ contentå€æ°ã«ç®çã®ããã¹ããé£çµããã ãã§ãã
次ã«ã insertFootNoteïŒïŒé¢æ°ãthe_contentïŒïŒé¢æ°ã«æ·»ä»ããŸãã
2è¡ç®ã«æ¬¡ã®ã³ãŒãã衚瀺ãããŸãã
- if ïŒ ïŒ is_feed ïŒ ïŒ && ïŒ is_home ïŒ ïŒ ïŒ {
ããã¹ããRSSãã£ãŒãã«å ¥ããå¿ èŠãããå Žåã¯ãåã®ã³ãŒãã次ã®ããã«çœ®ãæããŸãã
- if ïŒ ïŒ is_home ïŒ ïŒ ïŒ {
以äžã§ãã
5.ã¯ãŒããã¬ã¹ã³ã³ãããŒã«ããã«ã§æŽæ°ããŠãã ããã¡ãã»ãŒãžãç¡å¹ã«
åé¡ã
ããã·ã¥ããŒãã®äžéšã§ãWordpressã®æ°ããããŒãžã§ã³ã®å¯çšæ§ã«é¢ããæ å ±ã確èªã§ããŸãã æŽæ°ã«ããã»ãã¥ãªãã£ããŒã«ãéãããããšã³ãžã³ã®ææ°æ©èœã䜿çšã§ããããã«ãªããããããã¯æ¬åœã«è¯ãããšã§ãã ããããããã°ãå人çãªãã®ã§ã¯ãªããããããã®é¡§å®¢ã®ããã®ãããžã§ã¯ãã§ããå Žåã顧客ã«èªåèªèº«ãæŽæ°ããæ©äŒãäžããããšã¯è¯ãèãã§ã¯ãããŸããã
解決çã
次ã®ã³ãŒããfucntions.phpãã¡ã€ã«ã«è²Œãä»ããŠãã ãã ã
- if ïŒ ïŒ current_user_can ïŒ 'edit_users' ïŒ ïŒ {
- add_action ïŒ 'init' ã create_function ïŒ '$ a' ã "remove_actionïŒ 'init'ã 'wp_version_check'ïŒ;" ïŒ ã 2 ïŒ ;
- add_filter ïŒ 'pre_option_update_core' ã create_function ïŒ '$ a' ã "return null;" ïŒ ïŒ ;
- }
functions.phpãã¡ã€ã«ãä¿åãããšãã¡ãã»ãŒãžã¯è¡šç€ºãããªããªããŸãã
ã³ãŒãã®èª¬æã
ãŸããçŸåšã®ãŠãŒã¶ãŒãWordpressãæŽæ°ã§ããããã«ååãªç®¡çè æš©éãæã£ãŠããããšã確èªããŠãã ããã ããã確信ãããããã«ãããã·ã¥ããŒãã«ã¡ãã»ãŒãžã衚瀺ããããã®ã«ãŒã«ãæžãæããããã€ãã®ããã¯ãäœæããŸãã
6.èªåãã¹ãã¹ãã¬ãŒãžãç¡å¹ã«ãã
åé¡ã
Wordpressã¯ã玹ä»ãããæçš¿ãå®æçã«ä¿åããŸãã ããã¯äŸ¿å©ãªæ©èœã§ãããå¿ èŠãªãå ŽåããããŸãã
解決çã
æçš¿ã®èªåä¿åãç¡å¹ã«ããã«ã¯ã functions.phpãã¡ã€ã«ãéããŠæ¬¡ã®ã³ãŒãã貌ãä»ããŸãã
- é¢æ° disableAutoSave ïŒ ïŒ {
- wp_deregister_script ïŒ ' autosave ' ïŒ ;
- }
- add_action ïŒ 'wp_print_scripts' ã 'disableAutoSave' ïŒ ;
ã³ãŒãã®èª¬æã
ç¹°ãè¿ããŸãããè€éãªããšã¯ãããŸãããèªåä¿åãç¡å¹ã«ãããããwp_print_scriptsïŒïŒ Wordpressé¢æ°ã«ãã€ã³ãããé¢æ°ãäœæããã ãã§ãã
7.ã³ã¡ã³ãä»ãã®ããŒãžã§ç¹°ãè¿ãã³ã³ãã³ããé ä¿¡ãã
åé¡ã
ã³ã³ãã³ãã®éè€ã¯ãããªãäžè¬çãªSEOã®åé¡ã§ãã
WordpressããŒãžã§ã³2.7ã§å°å ¥ãããããŒãžããŒã·ã§ã³ã·ã¹ãã ã¯ããã®åé¡ã解決ããŸããã
ã³ã¡ã³ãå ã®ã³ã³ãã³ãã®éè€ãé²ãããã«ãå±æ§rel = "canonical"ã䜿çšããŸãã
解決çã
次ã®ã³ãŒããã³ããŒããŠã functions.phpãã¡ã€ã«ã«è²Œãä»ããŸãã
- é¢æ° canonical_for_comments ïŒ ïŒ {
- ã°ããŒãã« $ cpage ã $ post ;
- if ïŒ $ cpage > 1 ïŒ ïŒ
- echo " \ n " ;
- echo "<link rel = 'canonical' href = '" ;
- echo get_permalink ïŒ $ post- > ID ïŒ ;
- echo "'/> \ n " ;
- endif ;
- }
- add_action ïŒ 'wp_head' ã 'canonical_for_comments' ïŒ ;
ã³ãŒãã®èª¬æã
æåã«ãã³ã¡ã³ãä»ãã®åããŒãžã«è¿œå ããé¢æ°ãäœæããŸãããã ããæåã®å±æ§ã¯ã rel =â canonicalâå±æ§ãæã€ãªã³ã¯ã¿ã°ã§ãã 次ã«ããã®é¢æ°ãWordpressé¢æ°wp_headïŒïŒã«ã¢ã¿ããããŸãã
8. PHPå€æ°ãšããŠPOSTãŸãã¯ããŒãžãååŸãã
åé¡ã
çŸåšã®æçš¿ãŸãã¯ããŒãžå šäœãPHPå€æ°ãšããŠååŸã§ããããšã¯ãæ¬åœã«çŽ æŽãããããšã§ãã ã³ã³ãã³ãã®äžéšãstr_replaceïŒïŒé¢æ°ã§çœ®ãæããããä»ã®ããšãå®è¡ãããã§ãããšããŸãããã
解決çã
ãŸããè€éãªããšã¯äœããããŸããã åãããšãè¡ããŸãïŒ functions.phpãã¡ã€ã«ã«æ¬¡ã®ã³ãŒããæ¿å ¥ããŸãã
- é¢æ°ã³ãŒã«ããã¯ïŒ $ buffer ïŒ {
- //ããã§ãããã¡ãå€æŽããæŽæ°ãããã³ãŒããè¿ããŸã
- $ãããã¡ã è¿ã ãŸãã
- }
- é¢æ° buffer_start ïŒ ïŒ {
- ob_start ïŒ "ã³ãŒã«ããã¯" ïŒ ;
- }
- é¢æ° buffer_end ïŒ ïŒ {
- ob_end_flush ïŒ ïŒ ;
- }
- add_action ïŒ 'wp_head' ã 'buffer_start' ïŒ ;
- add_action ïŒ 'wp_footer' ã 'buffer_end' ïŒ ;
ã³ãŒãã®èª¬æã
ãã®ããã¯ãæ©èœããã«ã¯ã次ã®3ã€ã®æ©èœãå¿ èŠã§ãã
- callbackïŒïŒ ïŒãã®é¢æ°ã¯ãããŒãžå šäœã$ãããã¡ãŒå€æ°ãšããŠè¿ããŸãã ããšãã°ãæ£èŠè¡šçŸã䜿çšããŠãå¿ èŠã«å¿ããŠå€æŽã§ããŸãã
- buffer_startïŒïŒ ïŒãã®é¢æ°ã¯ãããã¡ãªã³ã°ãéå§ããŸãã wp_headïŒïŒé¢æ°ã«ã¢ã¿ããããŸãã
- buffer_endïŒïŒ ïŒãã®é¢æ°ã¯ãããã¡ãã¯ãªã¢ããŸãã wp_footerïŒïŒé¢æ°ã«ã¢ã¿ããããŸãã
9.ã¹ã±ãžã¥ãŒã«ã€ãã³ãã«ããã¯ãšã¯ãã³ã䜿çšãã
åé¡ã
ãããããWordpressãã¹ã±ãžã¥ãŒã«ãããã€ãã³ãã䜿çšã§ããããšãæ¢ã«ãåç¥ã§ãããã ããšãã°ãäºåã«èšå®ããç¹å®ã®æéã«æçš¿ãå ¬éã§ããŸãã ããã¯ãšwp-cronã䜿çšããŠãç¬èªã®ã€ãã³ãã®ã¹ã±ãžã¥ãŒã«ãç°¡åã«èšå®ã§ããŸãã 次ã®äŸã§ã¯ãããã°ã«1æéã«1åé»åã¡ãŒã«ã¡ãã»ãŒãžãéä¿¡ããããã«åŒ·å¶ããŸãã
解決çã
次ã®ã³ãŒããfunctions.phpãã¡ã€ã«ã«è²Œãä»ããŸãã
- if ïŒ ïŒ wp_next_scheduled ïŒ 'my_task_hook' ïŒ ïŒïŒ {
- wp_schedule_event ïŒ time ïŒ ïŒ ã 'hourly' ã 'my_task_hook' ïŒ ;
- }
- add_action ïŒ 'my_task_hook' ã 'my_task_function' ïŒ ;
- function my_task_function ïŒ ïŒ {
- wp_mail ïŒ 'you@yoursite.com' ã 'èªåã¡ãŒã«' ã 'ããã«ã¡ã¯ãããã¯WordPressããèªåçã«ã¹ã±ãžã¥ãŒã«ãããã¡ãŒã«ã§ãã' ïŒ ;
- }
ã³ãŒãã®èª¬æã
ãã¡ãããæåã«è¡ãããšã¯ãå¿ èŠãªã¢ã¯ã·ã§ã³ãå®è¡ããé¢æ°ãäœæããããšã§ãã ãã®äŸã§ã¯ããã®é¢æ°ã¯my_task_functionïŒïŒãšåŒã°ããæå®ãããé»åã¡ãŒã«ã¢ãã¬ã¹ã«é»åã¡ãŒã«ãéä¿¡ããã ãã§ãã
ãã®é¢æ°ã®å®è¡ãã¹ã±ãžã¥ãŒã«ããã«ã¯ã wp_schedule_eventïŒïŒé¢æ°ã䜿çšããŸãã æž¡ãããæåŸã®åŒæ°ã¯ããã¯ãªã®ã§ãé¢æ°my_task_functionïŒïŒãmy_task_hookã« ãããã¯ãããŸãã
10.ãã¹ãŠã®ãããã¯ããããæ©èœã®ãªã¹ã
åé¡ã
äœãåé¡ãçºçããå Žåããã¹ãŠã®ããã¯ãããé¢æ°ã®ãªã¹ãã圹ç«ã¡ãŸãã
解決çã
åã®ãã¹ãŠã®ã³ãŒãã¹ãããããšåæ§ã«ã次ã®ã³ãŒãã¹ãããããfunctions.phpãã¡ã€ã«ã«æ¿å ¥ããå¿ èŠããããŸãã 䜿çšåŸã¯å¿ ãåé€ããŠãã ããã ããããªããšããããã°åŸã«ã¡ãã»ãŒãžã衚瀺ãããŸãã
- function list_hooked_functions ïŒ $ tag = false ïŒ {
- ã°ããŒãã« $ wp_filter ;
- if ïŒ $ tag ïŒ {
- $ hook [ $ tag ] = $ wp_filter [ $ tag ] ;
- if ïŒ ïŒ is_array ïŒ $ hook [ $ tag ] ïŒ ïŒïŒ {
- trigger_error ïŒ ã ' $ tag 'ããã¯ã«äœãèŠã€ãããŸããã ã E_USER_WARNING ïŒ ;
- åž°ã
- }
- }
- ãã®ä» {
- $ hook = $ wp_filter ;
- ksort ïŒ $ããã¯ ïŒ ;
- }
- echo '<pre>' ;
- foreach ïŒ $ tag as as $ tag => $ priority ïŒ {
- echo "<br />ïŒgt;ïŒgt;ïŒgt;ïŒgt;ïŒgt; \ g <strong> $ã¿ã° </ strong> <br />" ;
- ksort ïŒ $åªå 床 ïŒ ;
- foreach ïŒ $ priority as $ priority => $ function ïŒ {
- echo $ priority ;
- foreach ïŒ $ function as $ name => $ properties ïŒ echo " \ t $ name <br />" ;
- }
- }
- echo '</ pre>' ;
- åž°ã
- }
ãã®ã³ãŒããfunctions.phpãã¡ã€ã«ã«è²Œãä»ããåŸã list_hooked_functionsïŒïŒé¢æ°ãåŒã³åºããŸãã 圌女ã¯ãã¹ãŠã®ããã¯ãããé¢æ°ã®ãªã¹ãã衚瀺ããŸãã
- list_hooked_functions ïŒ ïŒ ;
ã³ãŒãã®èª¬æã
ãã®ã³ãŒãã¯ãããã¯åãé¢æ°ã®åŒæ°ãšããŠæž¡ããããã©ãããå€æããŸãã éä¿¡ãããå Žåãããã¯ã®ååã衚瀺ãããŸãã ç¹å®ã®æ©èœã®ããã¯ã®ã¿ã衚瀺ããããšãã§ããŸãã
- list_hooked_functions ïŒ 'wp_head' ïŒ ;