Passing a variable into Contact Form 7 [closed]

Contact Form 7 has a lot of useful hooks you can use to tie custom code into it at various points of the form submission process. They are tragically not well documented at all but you can find them by googling around. You probably want wpcf7_before_send_mail. Something like this in functions.php: function do_stuff($wpcf7) { // … Read more

Updating wp_options with an array on save_post results in duplicated entries

I had something similar going on when I tried to use the wp_editor() function while inside a custom metabox. It was wanting to save multiple times. Take a look at this. // SAVE Metabox for admin response add_action(‘post_updated’, ‘display_jwl_wp_etickets_response_meta_box_save’); function display_jwl_wp_etickets_response_meta_box_save( $post_id ){ if( defined( ‘DOING_AUTOSAVE’ ) && DOING_AUTOSAVE ) return; if( !isset( $_POST[‘jwl_wp_etickets_editor_box_nonce_check’] ) … Read more

How do I pass an array as an argument to a WP-CLI command?

This is probably impossible since WP-CLI pass the arguments directly to wp_insert_posts. I’m automating this with wp eval. For example: wp eval ‘wp_set_object_terms(12 , array(1, 2, 3), “course”);’ The post id can be obtained when you create the post with –porcelain: wp post create … –porcelain Or by normal query with post title: wp eval … Read more

Nice way to print_r arrays

I created a Kint plugin that works really well. I also integrates with the Debug Bar plugin. You can download it at: http://wordpress.org/extend/plugins/kint-debugger/ There are a few functions to help you out with WordPress specific globals: dump_wp_query() dump_wp() dump_post() For printing arrays in a styled, collapsible format you would do the following. $foo_bar = array( … Read more