Can add_image_size be added earlier

You can set the priority to 999 to make sure if you are going that way: add_action( ‘after_setup_theme’, ‘_my_action_add_image_sizes’, 999 ); but if you really want to make sure of that order, try making a custom action, here a small example: /** * Execute the action with do_action. */ function read_theme_options() { //all the logic … Read more

Display custom debug info inside page and not before head

Don’t print any debug info into the page directly. WordPress offers a wp-content/debug.log file which you can use. Enable debug and debug_log in your wp-config.php define( ‘WP_DEBUG’, true ); // turn debug mode on define( ‘WP_DEBUG_DISPLAY’, false ); // do not display errors define( ‘WP_DEBUG_LOG’, true ); // save errors to wp-content/debug.log define( ‘SAVEQUERIES’, true … Read more

WP search exclude last letter from string

You can use the get_search_query filter. function mySearchFunction($search_term){ $search_term = substr($search_term, 0, -1); return $search_term; } add_filter(‘get_search_query’,’mySearchFunction’); EDIT Action to filter query results: function mySearchFilterFunction($query) { if ( !is_admin() && $query->is_main_query() && $query->is_search) { $search_term = $query->get(‘s’); $query->set(‘s’, substr($search_term, 0, -1)); } } add_action( ‘pre_get_posts’, ‘mySearchFilterFunction’); get_search_query filter is not needed because it uses get_query_var( … Read more

call a function when insert and update a custom post type

This is the original answer but it is little faulty, look below for the updated You can use following approach. The my_action_updated_post_meta is executed after the post insert or update is done: // define the updated_post_meta callback function my_action_updated_post_meta( $array, $int, $int ) { global $post; // see your updated post print_r($post); // make your … Read more

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