remove_action conditionally for Custom Post Type

Query variable only can be accessed after wp_query has been called. In you call, the get_post_type() function is actually returning an empty value. It should be working, if you change the hook to something which fires after wp_query is called. So, You should use – add_action(‘wp’, ‘kiwi_remove_post_author_box’); OR add_action(‘template_redirect’, ‘kiwi_remove_post_author_box’); Also, hooks can removed with … Read more

Create hooks based on an array of hook names?

Your proposal is OK – you can see this in action even in the WordPress itself. See admin-ajax.php where you can find this piece of code: // Register core Ajax calls. if ( ! empty( $_GET[‘action’] ) && in_array( $_GET[‘action’], $core_actions_get ) ) add_action( ‘wp_ajax_’ . $_GET[‘action’], ‘wp_ajax_’ . str_replace( ‘-‘, ‘_’, $_GET[‘action’] ), 1 … Read more

Hide WordPress Plugin Deactivation Links

There is a filter called plugin_action_links that lets you do this. function wpse253902_disable_plugin_deactivation ($actions, $plugin_file, $plugin_data, $context) { if (array_key_exists (‘deactivate’, $actions)) unset( $actions[‘deactivate’] ); return $actions; } There is even a filter plugin_action_links_{plugin_name} that lets you control the links on individual plugins. If you dive into it, you will find out that you can … Read more

Filter all html output

You can’t protect against everything a user will do. What if they hard-code an email address in the footer/header/sidebar of their theme? The only way to capture and escape that is with output buffering … and that can become a performance nightmare. My recommendation would be to do two things: Hook in to all of … Read more

Best possible way to get all options

I think it is always better to use the API, the functions of WP in this context. The function wp_load_alloptions() is under maintain and a custom select must always tested and maintain. Also the function use the Cache, if the installation support this. A good point for performance. The function supports also the Multisite installation, … Read more

Dynamically Override Fancy Title

The original function ends with this line: return apply_filters( ‘presscore_get_page_title’, $title ); That’s your cue. You can build a filter that completely overrules the $title generated by that function. Like this: add_filter (‘presscore_get_page_title’,’wpse263380_presscore_get_page_title’,10,1); function wpse263380_presscore_get_page_title ( $title ) { $title=”My awesome title”; return $title; }

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)