Pass important values server-side when processing form

To be honest I think this question is off topic, because its topic is so a general concept that can apply to any language capable to handle web development. So is even broader than a general PHP question. By the way, what I want to suggest is too much for a comment. When you need … Read more

How to extract information from a wp_query result?

The below is starting after you do your query: $slide_list = array(); if ( $slides->have_posts() ) { while ( $slides->have_posts() ) { Grab the next slide using next_post to grab it without stomping globals $slide = $slides->next_post(); $slide_id = $slide->ID; Your image title is your post title: $slide_title = $slide->post_title; Your href is your permalink … Read more

How to add Post Tags to a new element in header.php?

Use get_the_tags() instead of the_tags(), get_the_tags() does the following for you: Returns an array of objects, one object for each tag assigned to the post. with which you can work with to achieve what you want. See the examples on the codex page for more information.

save metabox with new values _wp_page_template

I swear to god…..!!! Every time I ask a question here I seem to find the answer…. I missed the verification: echo ‘<input type=”hidden” name=”meta_box_template_picker_nonce” value=”‘.wp_create_nonce(basename(__FILE__)).'” />’; Below is the complete code. If you think you can use this please do. If you wish to use it but don’t know how: 1. Create a seperate … Read more

Is it legal to redefine wp_password_change_notification in a mu plugin?

Here are the contents of a working example, placed in a php file in wp-includes/mu-plugins/. The email is sent when a user completes the password reset action after clicking the reset link in the email they receive. <?php if( ! function_exists( ‘wp_password_change_notification’ ) ){ function wp_password_change_notification( &$user ){ wp_mail( get_option(‘admin_email’), ‘Test’, ‘test’ ); } }

How to add author’s posts link (HTML + PHP) inside a function to output it

Try adding this line right after the one you mention: $outputSlide .= ‘<a href=”‘ . get_author_posts_url( get_the_author_meta( ‘ID’ ) ) . ‘”>’ . get_the_author_meta( ‘display_name’ ) . ‘</a>’; Note change of the_author_meta() to get_the_author_meta(). the_author_meta() will echo the result, whereas get_the_author_meta() just gets the result which is added to the $outputSlide variable and returned as … Read more

Why doesn’t global $wp_query not get hooked?

If you look at the Action Reference, you can see the order things happen. Note where init is, the query object doesn’t exist until the wp action. // … init └─ widgets_init register_sidebar wp_register_sidebar_widget wp_default_scripts wp_default_styles admin_bar_init add_admin_bar_menus wp_loaded parse_request send_headers parse_query pre_get_posts posts_selection wp // …