$ wp cli cmd-dump Download, install, update and manage a WordPress install. Download WordPress core $ wp core download --locale=nl_NL Install WordPress $ wp core install --url=example.com --title=Example --admin_user=supervisor -- admin_password=strongpassword [email protected] Display the WordPress version $ wp core version Transform a single-site install into a WordPress multisite install. $ wp core multisite-convert Install WordPress multisite from scratch. $ wp core multisite-install Manage users List user IDs $ wp user list --field=ID Create a new user. $ wp user create bob [email protected] --role=author Update an existing user. $ wp user update 123 --display_name=Mary --user_pass=marypass Delete user 123 and reassign posts to user 567 $ wp user delete 123 --reassign=567 Perform basic database operations using credentials stored in wp-config.php Create a new database. https://riptutorial.com/ 183
$ wp db create Drop an existing database. $ wp db drop --yes Reset the current database. $ wp db reset --yes Execute a SQL query stored in a file. $ wp db query < debug.sql Read WP-CLI online: https://riptutorial.com/wordpress/topic/9169/wp-cli https://riptutorial.com/ 184
Chapter 72: WP-Cron Examples wp_schedule_event() example // register activation hook register_activation_hook( __FILE__, 'example_activation' ); // function for activation hook function example_activation() { // check if scheduled hook exists if ( !wp_next_scheduled( 'my_event' )) { // Schedules a hook // time() - the first time of an event to run ( UNIX timestamp format ) // 'hourly' - recurrence ('hourly', 'twicedaily', 'daily' ) // 'my_event' - the name of an action hook to execute. wp_schedule_event( time(), 'hourly', 'my_event' ); } } add_action( 'my_event', 'do_this_hourly' ); // the code of your hourly event function do_this_hourly() { // put your code here } // register deactivation hook register_deactivation_hook(__FILE__, 'example_deactivation'); // function for deactivation hook function example_deactivation() { // clear scheduled hook wp_clear_scheduled_hook( 'my_event' ); } Important: the WordPress cron runs only when some page of your website is hit. So, for website with low trafic you need to setup the cron on your hosting to hit pages. custom recurrence interval in wp_schedule_event() // this function add custom interval (5 minutes) to the $schedules function five_minutes_interval( $schedules ) { $schedules['five_minutes'] = array( 'interval' => 60 * 5, 'display' => '5 minutes'; ); return $schedules; } // add a custom interval filter add_filter( 'cron_schedules', 'five_minutes_interval' ); https://riptutorial.com/ 185
// Schedules a hook wp_schedule_event( time(), 'five_minutes', 'my_event' ); Read WP-Cron online: https://riptutorial.com/wordpress/topic/6783/wp-cron https://riptutorial.com/ 186
Credits S. Chapters Contributors No 1 Getting started with 4444, A. Raza, Andrew, animuson, Anupam, Chris Fletcher, WordPress Ciprian, Community, Florida, James Jones, JonasCz, Leo F, Marc St Raymond, Mayank Gupta, Milap, nus, Panda, rap-2-h, Seth C., Shubham, Trevor Clarke, vajrasar 2 Actions and Filters David, Ihor Vorotnov, Mrinal Haque, Trying Tobemyself 3 Add Shortcode purvik7373, RamenChef Add/remove contact info for users with 4 user_contactmethods Petar Popovic, RamenChef filter hook 5 add_action() Abel Melquiades Callejo, Waqas Bukhary 6 add_editor_style() Gabriel Chi Hong Lee 7 add_menu_page() brasofilo, Gabriel Chi Hong Lee 8 add_submenu_page() Gabriel Chi Hong Lee, theoretisch 9 add_theme_support() Gabriel Chi Hong Lee 10 Admin Dashboard theoretisch Widgets 11 AJAX Andy, Digvijayad, Gaurav Srivastava, GreatBlakes, Nisarg Patel, Ruslan Murarov, stweb 12 Alternating main loop Dawid Urbanski, Petar Popovic (pre_get_posts filter) 13 Child Theme Basics Andrei, Razvan Onofrei, Vlad Olaru 14 Create a Post RamenChef, Roel Magdaleno, RRikesh Programmatically 15 Create Template for Ashok G, Egnaro, Joe Dooley, mnoronha Custom Post Type 16 Creating a custom Petar Popovic template https://riptutorial.com/ 187
Custom exerpts with inkista, Petar Popovic, RamenChef 17 excerpt_length and excerpt_more 18 Custom Post Types Caio Felipe Pereira, Dan Devine, J.D., janw, jgraup, Kushal Shah, Omar Khaiyam, Ranuka, theoretisch Customizer Basics 4444, Ahmad Awais, RamenChef 19 (Add Panel, Section, Setting, Control) 20 Customizer Hello Dan Green-Leipciger World 21 Debugging barbocc, dingo_d, jgraup 22 Enqueuing scripts dingo_d, Harshal Limaye, J.D., mbacon40, montrealist, Pelmered, Petar Popovic 23 Enqueuing Styles dingo_d, Harshal Limaye, Laxmana, mnoronha, montrealist, Petar Popovic, RamenChef, Ruslan Murarov, virtualLast Function : Harshal Limaye 24 wp_trim_words() 25 Function: add_action() bosco, RamenChef 26 get_bloginfo() Abel Melquiades Callejo, Harshal Limaye, HeyCameron, KenB , Nate Beers, RamenChef, Tom J Nowell, virtualLast, Wes Moberly 27 get_home_path() Ihor Vorotnov 28 get_option() Gabriel Chi Hong Lee 29 get_permalink() Gabriel Chi Hong Lee 30 get_template_part() Dan Devine, Kushal Shah 31 get_the_category() Gabriel Chi Hong Lee 32 get_the_title() Gabriel Chi Hong Lee 33 home_url() dingo_d, Kushal Shah, matthew, Mr. Developer How Can I integrate Fatbit Markdown editor with 34 Advance Custom Field's repeater Add- on. https://riptutorial.com/ 188
35 init Abel Melquiades Callejo, barbocc 36 Installation and Kenyon, Marco Romano, Ping.Chen, S.L. Barth, stig-js, Configuration theoretisch, Yuan Lung Luo Making network Jordan, mjangda, Rarst 37 requests with HTTP API 38 Meta Box Austin Winstanley 39 Options API Harshal Limaye, Pat J, RamenChef 40 Plugin development Angle.Ŗ, Ping.Chen 41 Post Formats Shashank Agarwal 42 Querying posts dingo_d Remove Auto Line Austin Winstanley 43 Breaks From Content and Excerpt Remove Version from 44 Wordpress and jay.jivani, mnoronha, theoretisch Stylesheets 45 REST API Picard Run WordPress local 46 with XAMPP Pierre.Vriens, theoretisch 47 Secure your James Jones installation 48 Security in WordPress Laxmana, the4kman - Escaping 49 Security in WordPress Laxmana - Sanitization 50 Shortcode Ad Wicks, Adam Genshaft, brasofilo, John Slegers, Kylar, Shashank Agarwal 51 Shortcode with Digvijayad, Firefog, RamenChef attribute 52 Shortcodes Pelmered 53 Sidebars dingo_d, Kushal Shah, theoretisch https://riptutorial.com/ 189
54 Site Migration Austin Winstanley 55 Taxonomies adifatz, Kushal Shah, purvik7373 56 Template hierarchy jgraup, MarZab, Pelmered, theoretisch 57 template_include Abel Melquiades Callejo, David, RamenChef 58 The $wpdb Object Kushal Shah, mcon, stweb The Admin Bar (aka dingo_d, Harshal Limaye, JCL1178, Kushal Shah 59 \"The Toolbar\") 60 The Loop (main anik4e, Dawid Urbanski WordPress loop) 61 the_title() Gabriel Chi Hong Lee 62 Themes Jef 63 Update WordPress KnightHawk Manually 64 WordPress Plugin Seth C. creation Wordpress theme and 65 child-theme Deathstorm development 66 wp_get_current_user() Abel Melquiades Callejo, Benoti, Muhammad Farrukh Faizy 67 WP_Query() Loop vrajesh 68 WP-CLI jgraup 69 WP-Cron stweb https://riptutorial.com/ 190
Search
Read the Text Version
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121
- 122
- 123
- 124
- 125
- 126
- 127
- 128
- 129
- 130
- 131
- 132
- 133
- 134
- 135
- 136
- 137
- 138
- 139
- 140
- 141
- 142
- 143
- 144
- 145
- 146
- 147
- 148
- 149
- 150
- 151
- 152
- 153
- 154
- 155
- 156
- 157
- 158
- 159
- 160
- 161
- 162
- 163
- 164
- 165
- 166
- 167
- 168
- 169
- 170
- 171
- 172
- 173
- 174
- 175
- 176
- 177
- 178
- 179
- 180
- 181
- 182
- 183
- 184
- 185
- 186
- 187
- 188
- 189
- 190
- 191
- 192
- 193
- 194
- 195
- 196
- 197
- 198
- 199
- 200
- 201
- 202
- 203
- 204
- 205
- 206
- 207
- 208