SlideShare a Scribd company logo
Wordpress Hook
Wednesday, March 1, 2017 www.qsoftvietnam.com 1
Presenter:
HopLB
Wednesday, March 1, 2017 www.qsoftvietnam.com 2
Table of content
I. What is a hook?
II. Type of hook in Wordpress
III. How to “hook”?
IV. Removing hook
V. Some advice
Wednesday, March 1, 2017 www.qsoftvietnam.com 3
What is a Hook?
Hooks allow you to change the core functionality of WordPress. They
are implemented through themes and plugins.
Wednesday, March 1, 2017 www.qsoftvietnam.com 4
Wednesday, March 1, 2017 www.qsoftvietnam.com 5
Type of shortcode in Wordpress
There are two kinds of hooks in WordPress: Actions and Filters
Wednesday, March 1, 2017 www.qsoftvietnam.com 6
How to “action hook”
Existing action:
https://codex.wordpress.org/Plugin_API/Action_Reference
Wednesday, March 1, 2017 www.qsoftvietnam.com 7
How to “action hook”
Use actions when you want to add something to the existing page such
as stylesheets, JavaScript dependencies, or send an email when an
event has happened.
Wednesday, March 1, 2017 www.qsoftvietnam.com 8
How to “action hook”
Wednesday, March 1, 2017 www.qsoftvietnam.com 9
How to “filter hook”
Existing filter:
https://codex.wordpress.org/Plugin_API/Filter_Reference
Wednesday, March 1, 2017 www.qsoftvietnam.com 10
How to “filter hook”
Use filters when you want to manipulate data coming out of the
database prior to going to the browser, or coming from the browser
prior to going into the database.
Wednesday, March 1, 2017 www.qsoftvietnam.com 11
How to “filter hook”
The callback functions attached to filter hook $tag are invoked by calling this
function.
This function can be used to create a new filter hook by simply calling this
function with the name of the new hook specified using the $tag parameter.
Wednesday, March 1, 2017 www.qsoftvietnam.com 12
How to removing hooks
Wednesday, March 1, 2017 www.qsoftvietnam.com 13
Advice
• Function names must be unique (Prefix your function)
• Use function_exists before register a function
• Your custom hook must be unique (Prefix your hook names)
• Dynamic hook names: 'pre_option_' . $option
• Use did_action or doing_action in case you need to check
THANK YOU FOR
YOUR ATTENTION !
Wednesday, March 1, 2017 www.qsoftvietnam.com 14

More Related Content

PPTX
Being a pimp without silverlight
PPTX
Being a pimp without silverlight
PDF
Moving at the Speed-of-Cloud Without Getting Owned
PDF
PDF
Unity clinic3-unityscript-basics-part2
PDF
ES6 katas - talk given at enterjs
PPTX
Tìm hiểu Wordpress shortcode
PDF
Bài giảng HTML5-CSS3
Being a pimp without silverlight
Being a pimp without silverlight
Moving at the Speed-of-Cloud Without Getting Owned
Unity clinic3-unityscript-basics-part2
ES6 katas - talk given at enterjs
Tìm hiểu Wordpress shortcode
Bài giảng HTML5-CSS3

Viewers also liked (12)

PPSX
Bes at sunset
PDF
Highlights of ethiopian energy sector, dresden, germany
DOCX
Sai kiran resume(sss)
DOCX
Sai kiran resume(sss)
PPTX
EltexSl feb_17_vo_ip_gateways_2
PPTX
Суть работы
PDF
Эффективная наружная реклама
PPTX
Sendsay- вебинар быстрый старт, март 2017
PPTX
PPTX
Педагог года 2018
PDF
E-magazine yatim mandiri februari 2017
PDF
Boson semicon division product range 2017
Bes at sunset
Highlights of ethiopian energy sector, dresden, germany
Sai kiran resume(sss)
Sai kiran resume(sss)
EltexSl feb_17_vo_ip_gateways_2
Суть работы
Эффективная наружная реклама
Sendsay- вебинар быстрый старт, март 2017
Педагог года 2018
E-magazine yatim mandiri februari 2017
Boson semicon division product range 2017
Ad

Similar to Tìm hiểu Wordpress hook (20)

PPTX
WordPress Hooks Action & Filters
PPTX
Wordpress hooks
ODP
5 W's of Hookin'
KEY
Actions filters
PDF
Hooked on WordPress: WordCamp Columbus
PPTX
Let’s write a plugin
PDF
Stop Hacking WordPress, Start Working with it - Charly Leetham - WordCamp Syd...
PPTX
Writing extensible plugins
PPTX
2016 WordCamp Pittsburgh - Let's Write a Plugin
PDF
Introduction to Wordpress Hooks
PDF
Creating Your First WordPress Plugin
PDF
How I Became a WordPress Hacker
PDF
Hooks, Actions, and Filters Oh My!
PPTX
Introduction to WordPress Development - Hooks
PDF
WordPress hooks - WPLDN July 2013 Meetup
PDF
Introduction to WordPress Hooks 2016
PPTX
WordPress plugin #2
PDF
My first WordPress Plugin
PDF
php[world] Hooks, Actions and Filters Oh My!
PDF
Jumping Into WordPress Plugin Programming
WordPress Hooks Action & Filters
Wordpress hooks
5 W's of Hookin'
Actions filters
Hooked on WordPress: WordCamp Columbus
Let’s write a plugin
Stop Hacking WordPress, Start Working with it - Charly Leetham - WordCamp Syd...
Writing extensible plugins
2016 WordCamp Pittsburgh - Let's Write a Plugin
Introduction to Wordpress Hooks
Creating Your First WordPress Plugin
How I Became a WordPress Hacker
Hooks, Actions, and Filters Oh My!
Introduction to WordPress Development - Hooks
WordPress hooks - WPLDN July 2013 Meetup
Introduction to WordPress Hooks 2016
WordPress plugin #2
My first WordPress Plugin
php[world] Hooks, Actions and Filters Oh My!
Jumping Into WordPress Plugin Programming
Ad

More from Lương Bá Hợp (12)

PPTX
PPTX
Cắt giao diện website từ file photoshop
PDF
Tài liệu HTML5-CSS3
PPTX
Đồ án tốt nghiệp : Xậy dựng hệ thống quản lý doanh nghiệp đa nền tảng
PPTX
Application PhoneGap with Google Map
PPTX
Tìm đường trên di động (PhoneGap)
PPTX
Ứng dụng từ điển cho SmartPhone từ Framework PhoneGap trên nền tảng Android
PPTX
Thuật Toán BEA (Bond Energy Algorithm)
PPTX
Tấn Công DDOS
PPT
Thuật toán Brich , Khai phá dữ liệu
PPT
Tìm hiểu về Joomla
PPTX
Quản lý dự án phần mềm bằng SVN
Cắt giao diện website từ file photoshop
Tài liệu HTML5-CSS3
Đồ án tốt nghiệp : Xậy dựng hệ thống quản lý doanh nghiệp đa nền tảng
Application PhoneGap with Google Map
Tìm đường trên di động (PhoneGap)
Ứng dụng từ điển cho SmartPhone từ Framework PhoneGap trên nền tảng Android
Thuật Toán BEA (Bond Energy Algorithm)
Tấn Công DDOS
Thuật toán Brich , Khai phá dữ liệu
Tìm hiểu về Joomla
Quản lý dự án phần mềm bằng SVN

Recently uploaded (20)

PPTX
MYSQL Presentation for SQL database connectivity
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
cuic standard and advanced reporting.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Approach and Philosophy of On baking technology
PPT
Teaching material agriculture food technology
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Encapsulation theory and applications.pdf
PPTX
Big Data Technologies - Introduction.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
NewMind AI Weekly Chronicles - August'25 Week I
MYSQL Presentation for SQL database connectivity
Agricultural_Statistics_at_a_Glance_2022_0.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
cuic standard and advanced reporting.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
sap open course for s4hana steps from ECC to s4
Building Integrated photovoltaic BIPV_UPV.pdf
Spectral efficient network and resource selection model in 5G networks
Approach and Philosophy of On baking technology
Teaching material agriculture food technology
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Network Security Unit 5.pdf for BCA BBA.
Encapsulation theory and applications.pdf
Big Data Technologies - Introduction.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
NewMind AI Weekly Chronicles - August'25 Week I

Tìm hiểu Wordpress hook

  • 1. Wordpress Hook Wednesday, March 1, 2017 www.qsoftvietnam.com 1 Presenter: HopLB
  • 2. Wednesday, March 1, 2017 www.qsoftvietnam.com 2 Table of content I. What is a hook? II. Type of hook in Wordpress III. How to “hook”? IV. Removing hook V. Some advice
  • 3. Wednesday, March 1, 2017 www.qsoftvietnam.com 3 What is a Hook? Hooks allow you to change the core functionality of WordPress. They are implemented through themes and plugins.
  • 4. Wednesday, March 1, 2017 www.qsoftvietnam.com 4
  • 5. Wednesday, March 1, 2017 www.qsoftvietnam.com 5 Type of shortcode in Wordpress There are two kinds of hooks in WordPress: Actions and Filters
  • 6. Wednesday, March 1, 2017 www.qsoftvietnam.com 6 How to “action hook” Existing action: https://codex.wordpress.org/Plugin_API/Action_Reference
  • 7. Wednesday, March 1, 2017 www.qsoftvietnam.com 7 How to “action hook” Use actions when you want to add something to the existing page such as stylesheets, JavaScript dependencies, or send an email when an event has happened.
  • 8. Wednesday, March 1, 2017 www.qsoftvietnam.com 8 How to “action hook”
  • 9. Wednesday, March 1, 2017 www.qsoftvietnam.com 9 How to “filter hook” Existing filter: https://codex.wordpress.org/Plugin_API/Filter_Reference
  • 10. Wednesday, March 1, 2017 www.qsoftvietnam.com 10 How to “filter hook” Use filters when you want to manipulate data coming out of the database prior to going to the browser, or coming from the browser prior to going into the database.
  • 11. Wednesday, March 1, 2017 www.qsoftvietnam.com 11 How to “filter hook” The callback functions attached to filter hook $tag are invoked by calling this function. This function can be used to create a new filter hook by simply calling this function with the name of the new hook specified using the $tag parameter.
  • 12. Wednesday, March 1, 2017 www.qsoftvietnam.com 12 How to removing hooks
  • 13. Wednesday, March 1, 2017 www.qsoftvietnam.com 13 Advice • Function names must be unique (Prefix your function) • Use function_exists before register a function • Your custom hook must be unique (Prefix your hook names) • Dynamic hook names: 'pre_option_' . $option • Use did_action or doing_action in case you need to check
  • 14. THANK YOU FOR YOUR ATTENTION ! Wednesday, March 1, 2017 www.qsoftvietnam.com 14