Hot answers tagged

4

I guess you mean add_action( 'pre_get_posts', 'private_groups' ); add_action( 'pre_get_posts', 'search_results' ); add_action( 'pre_get_posts', 'name_profiles' ); versus add_action( 'pre_get_posts', 'combined_into_single_callback' ); You can just check the difference using e.g. memory_get_usage() and timer_stop(). Many good plugins out there to help ...


3

Think of wp_lostpassword_url() as a placeholder for the link to the page containing the form to allow users to reset their password. You can use this placeholder anywhere within your WordPress site and if you decide to provide your own form to allow users to reset their password you can easily update the link via the filter: class Customuser { public ...


3

They were both introduced in version 2.9, but were done so in different files. update_postmeta went into /wp-admin/includes/post.php While... update_{$meta_type}_meta went into /wp-includes/meta.php It was only later that update_postmeta was shifted into /wp-includes/meta.php. So I believe it was for backward compatability, where by because the ...


2

It really just depends on what you need to do here. The general method is to hook all your theme support features to after_setup_theme for some obvious reasons. after_setup_theme is the first action hook available to themes to add any type of support the theme. Certain features has to be registered here and cannot be registered later. One feature that ...


2

If you want to redirect, a good event to use is template_redirect: add_action( 'template_redirect', 'my_page_template_redirect' ); function my_page_template_redirect() { // You can skip is_user_logged_in() if checking the user capability if( is_page( 1234 ) && ! current_user_can( 'do_something_special' ) ) { $redirect_to = ...


1

Unfortunately there is no hook available to remove that "Our Bank Details" text. But, you can hide the default which is added and un-intended area by placing following rule in your theme's style.css file: .woocommerce-order-received .woocommerce h2:nth-of-type(2) { display: none; } Then to have "Our Bank Details" at intended place, simply go to ...


1

Constructors should not do any any work, they are there for instantiation of your class. It is good that you are trying to build classes that are only concerned to doing one single thing (SOC). I think your issue is more of how to use these classes as a combined working system, because, if done corrctly, you should not have the issue you are having. For me, ...


1

I had time to look at your issue and the options-reading.php page which is the template used to render the reading settings page in backend. There are unfortunately no filters to filter or add custom posts as sticky posts in a selectable dropdown. There are two hidden filters though which we can use, they are wp_dropdown_pages inside the ...


1

The add_rewrite_rule function doesn't change the database. Just an array in memory. It is not an expensive operation. The alternative is to add code to detect whether your rule is there, which is actually more expensive than just modifying the array.



Only top voted, non community-wiki answers of a minimum length are eligible