47,35 €*
Versandkostenfrei per Post / DHL
Lieferzeit 1-2 Wochen
This significantly updated edition of Professional WordPress Plugin Development addresses modern plugin development for WordPress, the highly popular content management system (CMS). If you're using WordPress to create and manage websites, WordPress plugins are the software that can extend or enhance CMS functionality. This book offers guidance on writing plugins for WordPress sites to share or sell to other users.
The second edition of Professional WordPress Plugin Development covers the building of advanced plugin development scenarios. It discusses the plugin framework and coding standards as well as dashboards, settings, menus, and related application programming interfaces (APIs). Additional topics include security, performance, data validation, and SQL statements.
* Learn about the power of hooks in WordPress
* Discover how JavaScript and Ajax will work in your site
* Understand key technologies: Block Editor/Gutenberg, JS/React, PHP, and the REST API
* Create and use custom post types and taxonomies.
* Creating custom dashboard menus and plugin settings
* Work with users and user data
* Schedule tasks and utilizing Cron
* Performance and security considerations
Written by experienced plugin developers, Professional WordPress Plugin Development also helps you internationalize and localize your WordPress website. Find out about debugging systems and optimizing your site for speed. As WordPress use continues to increase, you can elevate your professional knowledge of how to extend WordPress through plugins.
This significantly updated edition of Professional WordPress Plugin Development addresses modern plugin development for WordPress, the highly popular content management system (CMS). If you're using WordPress to create and manage websites, WordPress plugins are the software that can extend or enhance CMS functionality. This book offers guidance on writing plugins for WordPress sites to share or sell to other users.
The second edition of Professional WordPress Plugin Development covers the building of advanced plugin development scenarios. It discusses the plugin framework and coding standards as well as dashboards, settings, menus, and related application programming interfaces (APIs). Additional topics include security, performance, data validation, and SQL statements.
* Learn about the power of hooks in WordPress
* Discover how JavaScript and Ajax will work in your site
* Understand key technologies: Block Editor/Gutenberg, JS/React, PHP, and the REST API
* Create and use custom post types and taxonomies.
* Creating custom dashboard menus and plugin settings
* Work with users and user data
* Schedule tasks and utilizing Cron
* Performance and security considerations
Written by experienced plugin developers, Professional WordPress Plugin Development also helps you internationalize and localize your WordPress website. Find out about debugging systems and optimizing your site for speed. As WordPress use continues to increase, you can elevate your professional knowledge of how to extend WordPress through plugins.
About the authors
Brad Williams is CEO and cofounder of WebDevStudios, a WordPress design and development firm. He is coauthor of Professional WordPress Design and Development.
Justin Tadlock is a plugin and theme developer with over a decade of professional experience. He currently writes for WP Tavern.
John James Jacoby has authored dozens of popular WordPress plugins and leads the development of bbPress and BuddyPress. He has contributed to every major WordPress version since 2008.
Introduction xxxi
Chapter 1: An Introduction to Plugins 1
What is a Plugin? 1
How Plugins Interact with WordPress 2
When are Plugins Loaded? 3
Available Plugins 4
Official Plugin Directory 4
Popular Plugin Examples 4
Popular Plugin Tags 5
Advantages of Plugins 5
Not Modifying Core 5
Why Reinvent the Wheel? 5
Separating Plugins and Themes 6
Easy Updates 7
Easier to Share and Reuse 7
Plugin Sandbox 7
Plugin Community 7
Installing and Managing Plugins 8
Installing a Plugin 8
Managing Plugins 9
Editing Plugins 9
Plugin Directories 9
Types of Plugins 10
Summary 11
Chapter 2: Plugin Framework 13
Requirements for Plugins 13
Naming Your Plugin 14
Using a Folder 14
Best Practices 14
Namespace Everything 14
File Organization 15
Folder Structure 16
Plugin Header 17
Creating the Header 17
Plugin License 18
Determining Paths 19
Plugin Paths 19
Local Paths 19
URL Paths 20
Activate/Deactivate Functions 22
Plugin Activation Function 22
Plugin Deactivation Function 23
Deactivate is Not Uninstall 23
Uninstall Methods 24
Why Uninstall is Necessary 24
[...] 24
Uninstall Hook 25
Coding Standards 25
Document Your Code 26
Naming Variables and Functions 27
Naming Classes and Methods 27
Naming Files 28
Single and Double Quotes 28
Indentation 28
Brace Style 29
Space Usage 29
Shorthand PHP 30
SQL Statements 30
Summary 30
Chapter 3: Dashboard And Settings 31
Adding Menus and Submenus 31
Creating a Top-Level Menu 32
Adding a Submenu 33
Adding a Menu Item to an Existing Menu 34
Plugin Settings 36
The Options API 36
Saving Options 36
Saving an Array of Options 37
Updating Options 37
Retrieving Options 38
Loading an Array of Options 39
Deleting Options 40
The Autoload Parameter 40
Segregating Plugin Options 41
Toggling the Autoload Parameter 42
The Settings API 42
Benefits of the Settings API 42
Settings API Functions 43
Creating the Plugin Administration Page 43
Registering New Settings 44
Defining Sections and Settings 44
Validating User Input 46
Rendering the Form 47
All Done! 48
Wrapping It Up: A Complete Plugin Management Page 48
Improving Feedback on Validation Errors 51
Expanding with Additional Field Types 52
Adding Fields to an Existing Page 59
How It Works 59
Adding a Section to an Existing Page 59
Adding Only Fields 60
WordPress' Sections and Setting Fields 61
User Interface Concerns 62
Removing Settings 62
Keeping It Consistent 63
Using the WordPress UI 64
Headings 64
Dashicons 64
Messages 65
Buttons 66
Form Fields 67
Tables 68
Pagination 69
Summary 70
Chapter 4: Security And Performance 71
Security Overview 72
What Securing Your Plugin is 72
What Securing Your Plugin is Not 72
User Permissions 72
How to Check current_user_can() 73
Do Not Check Too Early 73
Nonces 74
Authority vs. Intention 74
What is a Nonce? 75
How to Create and Verify Nonces 75
Creating a Nonce URL 76
Creating a Nonce Field 76
Creating and Verifying a Nonce in a Plugin 77
Data Validation and Sanitization 78
The Need for Data Validation and Sanitization 78
Good Practice: Identifying Potentially Tainted Data 80
Validating or Sanitizing Input? 81
Validating and Sanitizing Cookbook 81
Integers 81
Arbitrary Text Strings 82
Key and Identifier Strings 83
Email Strings 84
URLs 84
HTML 86
JavaScript 88
Environment and Server Variables 88
Arrays of Data 89
Database Queries 89
Formatting SQL Statements 90
The $wpdb Object 90
Why wpdb Methods are Superior 91
All-in-One Methods 91
>update() 92
>insert() 92
Common Methods 93
Select a Variable 93
Select a Row 94
Select a Column 94
Select Generic Results 95
Generic Queries 96
Protecting Queries against SQL Injections 96
Security Good Habits 97
Performance Overview 97
Caching 98
Saving Cached Data 98
Loading and Using Cached Data 99
Deleting Cached Data 99
Caching Data within a Plugin 100
Transients 101
Saving an Expiring Option 102
Retrieving an Expiring Option 102
Deleting an Expiring Option 102
A Practical Example Using Transients 102
Technical Details 103
Transient Ideas 103
Summary 104
Chapter 5: Hooks 105
Understanding Hooks 105
Actions 106
What is an Action? 107
Action Hook Functions 108
remove_action() 108
remove_all_actions() 109
do_action_ref_array 110
has_action 111
did_action() 112
current_action 112
register_activation_hook and register_deactivation_hook 113
Commonly Used Action Hooks 113
plugins_loaded 113
init 114
admin_menu 115
save_post 116
wp_head 116
Filters 117
What is a Filter? 118
Filter Hook Functions 119
remove_filter 119
remove_all_filters 120
apply_filters_ref_array 121
has_filter 122
current_filter 122
Quick Return Functions 123
Commonly Used Filter Hooks 124
the_content 124
template_include 125
Using Hooks from within a Class 126
Using Hooks with Anonymous Functions 127
Creating Custom Hooks 128
Benefits of Creating Custom Hooks 128
Custom Action Hook Example 128
Custom Filter Hook Example 129
Finding Hooks 129
Searching for Hooks in the Core Code 130
Variable Hooks 130
Hook Reference Lists 130
Summary 131
Chapter 6: Javascript 133
Registering Scripts 134
Enqueueing Scripts 135
Limiting Scope 136
Localizing Scripts 136
Inline Scripts 137
Overview of Bundled Scripts 139
jQuery UI and Other Scripts 139
The WP Global 140
a11y Speak 140
Escaping 140
i18n 140
Heartbeat 141
Polyfills 141
Your Custom Scripts 141
jQuery 142
Benefits of Using jQuery 142
jQuery Crash Course 142
The jQuery Object 143
Syntax and Chaining 143
No-Conflict Mode in WordPress 144
Launching Code on Document Ready 144
Ajax 145
Backbone/Underscore 146
React 146
Summary 147
Chapter 7: Blocks And Gutenberg 149
What is Gutenberg? 149
Touring Gutenberg 151
Practical Examples 155
WooCommerce 156
The Events Calendar 157
Post Type Switcher 158
Technology Stack of Gutenberg 159
JavaScript 160
PHP 161
[...] 162
webpack 163
Babel 163
React 163
JSX 163
ES6 163
"Hello World!" Block 164
PHP 164
JavaScript 164
webpack 165
Command Line 166
Activation 167
Wrap-Up 167
WP-CLI Scaffolding 168
Plugin 168
Blocks 169
Includes 169
Activation 169
Wrap-Up 169
create-guten-block Toolkit 170
Installation 171
Activation 171
Wrap-Up 173
Block Directory 173
Summary 174
Chapter 8: Content 175
Creating Custom Post Types 176
Post Type Possibilities 176
Registering a Post Type 177
register_post_type 177
Registering the Book Collection Post Type 177
Setting Post Type Labels 179
Using Custom Capabilities 180
Attaching Existing Taxonomies 182
Post Metadata 183
Registering Post Metadata 183
Adding Post Metadata 184
Retrieving Post Metadata 185
Updating Post Metadata 186
Deleting Post Metadata 186
Meta Boxes 187
What is a Meta Box? 187
Adding a Custom Meta Box 188
Saving Meta Box Data 190
Creating Custom Taxonomies 191
Understanding Taxonomies 192
Registering a Custom Taxonomy 192
register_taxonomy 193
Registering the Genre Taxonomy 193
Assigning a Taxonomy to a Post Type 194
Using Custom Taxonomies 195
Retrieving a Taxonomy 196
Using a Taxonomy with Posts 196
Taxonomy Conditional Tags 197
taxonomy_exists 197
is_taxonomy_hierarchical 198
is_tax 198
A Post Type, Post Metadata, and Taxonomy Plugin 199
Summary 204
Chapter 9: Users And User Data 205
Working with Users 206
User Functions 206
is_user_logged_in() 206
get_users() 207
count_users 207
Creating, Updating, and Deleting Users 208
Creating a New User 209
Updating an Existing User 211
Deleting an Existing User 212
User Data 213
Getting a User Object and Data 213
Getting the Current User Object 215
Getting User Post Counts 215
User Metadata 217
Adding User Metadata 218
Retrieving User Metadata 218
Updating User Metadata 219
Deleting User Metadata 220
Creating a Plugin with User Metadata 220
Roles and Capabilities 223
What are Roles and Capabilities? 223
Default Roles 224
Custom Roles 224
Limiting Access 225
Checking User Permissions...
Erscheinungsjahr: | 2020 |
---|---|
Fachbereich: | Datenkommunikation, Netze & Mailboxen |
Genre: | Informatik |
Rubrik: | Naturwissenschaften & Technik |
Medium: | Taschenbuch |
Inhalt: | 480 S. |
ISBN-13: | 9781119666943 |
ISBN-10: | 1119666945 |
Sprache: | Englisch |
Herstellernummer: | 1W119666940 |
Einband: | Kartoniert / Broschiert |
Autor: |
Williams, Brad
Tadlock, Justin James Jacoby, John |
Auflage: | 2nd edition |
Hersteller: | Wiley |
Maße: | 236 x 190 x 27 mm |
Von/Mit: | Brad Williams (u. a.) |
Erscheinungsdatum: | 10.06.2020 |
Gewicht: | 0,891 kg |
About the authors
Brad Williams is CEO and cofounder of WebDevStudios, a WordPress design and development firm. He is coauthor of Professional WordPress Design and Development.
Justin Tadlock is a plugin and theme developer with over a decade of professional experience. He currently writes for WP Tavern.
John James Jacoby has authored dozens of popular WordPress plugins and leads the development of bbPress and BuddyPress. He has contributed to every major WordPress version since 2008.
Introduction xxxi
Chapter 1: An Introduction to Plugins 1
What is a Plugin? 1
How Plugins Interact with WordPress 2
When are Plugins Loaded? 3
Available Plugins 4
Official Plugin Directory 4
Popular Plugin Examples 4
Popular Plugin Tags 5
Advantages of Plugins 5
Not Modifying Core 5
Why Reinvent the Wheel? 5
Separating Plugins and Themes 6
Easy Updates 7
Easier to Share and Reuse 7
Plugin Sandbox 7
Plugin Community 7
Installing and Managing Plugins 8
Installing a Plugin 8
Managing Plugins 9
Editing Plugins 9
Plugin Directories 9
Types of Plugins 10
Summary 11
Chapter 2: Plugin Framework 13
Requirements for Plugins 13
Naming Your Plugin 14
Using a Folder 14
Best Practices 14
Namespace Everything 14
File Organization 15
Folder Structure 16
Plugin Header 17
Creating the Header 17
Plugin License 18
Determining Paths 19
Plugin Paths 19
Local Paths 19
URL Paths 20
Activate/Deactivate Functions 22
Plugin Activation Function 22
Plugin Deactivation Function 23
Deactivate is Not Uninstall 23
Uninstall Methods 24
Why Uninstall is Necessary 24
[...] 24
Uninstall Hook 25
Coding Standards 25
Document Your Code 26
Naming Variables and Functions 27
Naming Classes and Methods 27
Naming Files 28
Single and Double Quotes 28
Indentation 28
Brace Style 29
Space Usage 29
Shorthand PHP 30
SQL Statements 30
Summary 30
Chapter 3: Dashboard And Settings 31
Adding Menus and Submenus 31
Creating a Top-Level Menu 32
Adding a Submenu 33
Adding a Menu Item to an Existing Menu 34
Plugin Settings 36
The Options API 36
Saving Options 36
Saving an Array of Options 37
Updating Options 37
Retrieving Options 38
Loading an Array of Options 39
Deleting Options 40
The Autoload Parameter 40
Segregating Plugin Options 41
Toggling the Autoload Parameter 42
The Settings API 42
Benefits of the Settings API 42
Settings API Functions 43
Creating the Plugin Administration Page 43
Registering New Settings 44
Defining Sections and Settings 44
Validating User Input 46
Rendering the Form 47
All Done! 48
Wrapping It Up: A Complete Plugin Management Page 48
Improving Feedback on Validation Errors 51
Expanding with Additional Field Types 52
Adding Fields to an Existing Page 59
How It Works 59
Adding a Section to an Existing Page 59
Adding Only Fields 60
WordPress' Sections and Setting Fields 61
User Interface Concerns 62
Removing Settings 62
Keeping It Consistent 63
Using the WordPress UI 64
Headings 64
Dashicons 64
Messages 65
Buttons 66
Form Fields 67
Tables 68
Pagination 69
Summary 70
Chapter 4: Security And Performance 71
Security Overview 72
What Securing Your Plugin is 72
What Securing Your Plugin is Not 72
User Permissions 72
How to Check current_user_can() 73
Do Not Check Too Early 73
Nonces 74
Authority vs. Intention 74
What is a Nonce? 75
How to Create and Verify Nonces 75
Creating a Nonce URL 76
Creating a Nonce Field 76
Creating and Verifying a Nonce in a Plugin 77
Data Validation and Sanitization 78
The Need for Data Validation and Sanitization 78
Good Practice: Identifying Potentially Tainted Data 80
Validating or Sanitizing Input? 81
Validating and Sanitizing Cookbook 81
Integers 81
Arbitrary Text Strings 82
Key and Identifier Strings 83
Email Strings 84
URLs 84
HTML 86
JavaScript 88
Environment and Server Variables 88
Arrays of Data 89
Database Queries 89
Formatting SQL Statements 90
The $wpdb Object 90
Why wpdb Methods are Superior 91
All-in-One Methods 91
>update() 92
>insert() 92
Common Methods 93
Select a Variable 93
Select a Row 94
Select a Column 94
Select Generic Results 95
Generic Queries 96
Protecting Queries against SQL Injections 96
Security Good Habits 97
Performance Overview 97
Caching 98
Saving Cached Data 98
Loading and Using Cached Data 99
Deleting Cached Data 99
Caching Data within a Plugin 100
Transients 101
Saving an Expiring Option 102
Retrieving an Expiring Option 102
Deleting an Expiring Option 102
A Practical Example Using Transients 102
Technical Details 103
Transient Ideas 103
Summary 104
Chapter 5: Hooks 105
Understanding Hooks 105
Actions 106
What is an Action? 107
Action Hook Functions 108
remove_action() 108
remove_all_actions() 109
do_action_ref_array 110
has_action 111
did_action() 112
current_action 112
register_activation_hook and register_deactivation_hook 113
Commonly Used Action Hooks 113
plugins_loaded 113
init 114
admin_menu 115
save_post 116
wp_head 116
Filters 117
What is a Filter? 118
Filter Hook Functions 119
remove_filter 119
remove_all_filters 120
apply_filters_ref_array 121
has_filter 122
current_filter 122
Quick Return Functions 123
Commonly Used Filter Hooks 124
the_content 124
template_include 125
Using Hooks from within a Class 126
Using Hooks with Anonymous Functions 127
Creating Custom Hooks 128
Benefits of Creating Custom Hooks 128
Custom Action Hook Example 128
Custom Filter Hook Example 129
Finding Hooks 129
Searching for Hooks in the Core Code 130
Variable Hooks 130
Hook Reference Lists 130
Summary 131
Chapter 6: Javascript 133
Registering Scripts 134
Enqueueing Scripts 135
Limiting Scope 136
Localizing Scripts 136
Inline Scripts 137
Overview of Bundled Scripts 139
jQuery UI and Other Scripts 139
The WP Global 140
a11y Speak 140
Escaping 140
i18n 140
Heartbeat 141
Polyfills 141
Your Custom Scripts 141
jQuery 142
Benefits of Using jQuery 142
jQuery Crash Course 142
The jQuery Object 143
Syntax and Chaining 143
No-Conflict Mode in WordPress 144
Launching Code on Document Ready 144
Ajax 145
Backbone/Underscore 146
React 146
Summary 147
Chapter 7: Blocks And Gutenberg 149
What is Gutenberg? 149
Touring Gutenberg 151
Practical Examples 155
WooCommerce 156
The Events Calendar 157
Post Type Switcher 158
Technology Stack of Gutenberg 159
JavaScript 160
PHP 161
[...] 162
webpack 163
Babel 163
React 163
JSX 163
ES6 163
"Hello World!" Block 164
PHP 164
JavaScript 164
webpack 165
Command Line 166
Activation 167
Wrap-Up 167
WP-CLI Scaffolding 168
Plugin 168
Blocks 169
Includes 169
Activation 169
Wrap-Up 169
create-guten-block Toolkit 170
Installation 171
Activation 171
Wrap-Up 173
Block Directory 173
Summary 174
Chapter 8: Content 175
Creating Custom Post Types 176
Post Type Possibilities 176
Registering a Post Type 177
register_post_type 177
Registering the Book Collection Post Type 177
Setting Post Type Labels 179
Using Custom Capabilities 180
Attaching Existing Taxonomies 182
Post Metadata 183
Registering Post Metadata 183
Adding Post Metadata 184
Retrieving Post Metadata 185
Updating Post Metadata 186
Deleting Post Metadata 186
Meta Boxes 187
What is a Meta Box? 187
Adding a Custom Meta Box 188
Saving Meta Box Data 190
Creating Custom Taxonomies 191
Understanding Taxonomies 192
Registering a Custom Taxonomy 192
register_taxonomy 193
Registering the Genre Taxonomy 193
Assigning a Taxonomy to a Post Type 194
Using Custom Taxonomies 195
Retrieving a Taxonomy 196
Using a Taxonomy with Posts 196
Taxonomy Conditional Tags 197
taxonomy_exists 197
is_taxonomy_hierarchical 198
is_tax 198
A Post Type, Post Metadata, and Taxonomy Plugin 199
Summary 204
Chapter 9: Users And User Data 205
Working with Users 206
User Functions 206
is_user_logged_in() 206
get_users() 207
count_users 207
Creating, Updating, and Deleting Users 208
Creating a New User 209
Updating an Existing User 211
Deleting an Existing User 212
User Data 213
Getting a User Object and Data 213
Getting the Current User Object 215
Getting User Post Counts 215
User Metadata 217
Adding User Metadata 218
Retrieving User Metadata 218
Updating User Metadata 219
Deleting User Metadata 220
Creating a Plugin with User Metadata 220
Roles and Capabilities 223
What are Roles and Capabilities? 223
Default Roles 224
Custom Roles 224
Limiting Access 225
Checking User Permissions...
Erscheinungsjahr: | 2020 |
---|---|
Fachbereich: | Datenkommunikation, Netze & Mailboxen |
Genre: | Informatik |
Rubrik: | Naturwissenschaften & Technik |
Medium: | Taschenbuch |
Inhalt: | 480 S. |
ISBN-13: | 9781119666943 |
ISBN-10: | 1119666945 |
Sprache: | Englisch |
Herstellernummer: | 1W119666940 |
Einband: | Kartoniert / Broschiert |
Autor: |
Williams, Brad
Tadlock, Justin James Jacoby, John |
Auflage: | 2nd edition |
Hersteller: | Wiley |
Maße: | 236 x 190 x 27 mm |
Von/Mit: | Brad Williams (u. a.) |
Erscheinungsdatum: | 10.06.2020 |
Gewicht: | 0,891 kg |