two search forms on the same page

The get_search_form function doesn’t work like that. The parameter that is accepted only specifies if the HTML content is being returned or outputted directly. So this parameter should be a boolean. It still works in your case because PHP simply evaluates the string that you are passing as true considering that it is not an … Read more

Function not saving unchecked checkbox

Strictly by what I see in your code: you are trying to unset incorrectly, unset works by means of an array key and you are using $term_id which is a value. You need to find the index in the array for that $term_id: function wpfs_save_tax( $term_id ) { $featured_tax = get_option( ‘_featured_tax’ ); if ( … Read more

How to modify get_the_excerpt() when post-format equals ‘quote’?

While writing the question in SE I already found the solution: add_filter( ‘get_the_excerpt’, ‘get_custom_the_excerpt’ ); function get_custom_the_excerpt($excerpt) { $post = get_post(); $format = get_post_format( $post ); // modify excerpt if it is a quote, for example set title as author if ($format == ‘quote’) { $output=”<q>”. $excerpt. ‘</q> <p class=”quoted”>’.get_the_title().'</p>’; } // return excerpt without … Read more

Use add_action within template

There is no limitation to using add_action(), except that core must have it loaded already. Practically this means pretty much anywhere, but wp-config.php. While it is possible to do it in template, it’s not a common practice because of: Timing issues (your template part might be loaded after the hooks you need). Code base clarity … Read more

remove/hide wp-editor

I believe the helper you’re looking for (assuming we’re not dealing with a custom post type) is: <?php remove_post_type_support(‘page’, ‘editor’); ?> When dealing with a custom post type you can exclude ‘editor’ from the ‘supports’ parameter to initialize the post type without the editor window. Finally, if you are trying to disable the editor only … Read more

wp_usermeta – Read from database, but save function broken

You have not provided the whole code so don’t understand where you are wrong, this script is working fine for me. add_action( ‘personal_options_update’, ‘save_extra_profile_fields’ ); add_action( ‘edit_user_profile_update’, ‘save_extra_profile_fields’ ); function save_extra_profile_fields( $user_id ) { if ( current_user_can(‘edit_user’,$user_id) ) update_user_meta($user_id, ‘uidnumber’, sanitize_text_field($_POST[‘uidnumber’])); } add_action(‘show_user_profile’, ‘show_extra_profile_fields’); add_action(‘edit_user_profile’, ‘show_extra_profile_fields’); function show_extra_profile_fields( $user ) { ?> <p class=”form-row form-row-wide”> … Read more