Search result page redirect ex.com/?s=searchterms to ex.com/searchterms

Write this in your theme’s functions.php. Hope this helps you out. function code_search() { if ( is_search() && strpos($_SERVER[‘REQUEST_URI’], ‘/wp-admin/’) === false && strpos($_SERVER[‘REQUEST_URI’], ‘/search/’) === false ) { wp_redirect( get_bloginfo(‘home’) . ‘/search/’ . str_replace(‘ ‘, ‘_’, str_replace(‘%20’, ‘_’, get_query_var(‘s’)))); exit(); } } add_action(‘template_redirect’, ‘code_search’);

Advanced Custom Fields: Sorting custom columns with custom fields sorts only by date

It appeared it was due to the fact that WordPress doesn’t understand that you need to order by certain post meta unless you specify it. So in my case adding this fixed the sorting issue: add_action( ‘pre_get_posts’, ‘custom_orderby’ ); function custom_orderby( $query ) { if( ! is_admin() ) return; $orderby = $query->get( ‘orderby’); if( ‘featured’ … Read more

TinyMCE custom dialog with selectbox not working

Try type: ‘listbox’, values: [{text: ‘small’}, {text: ‘normal’}, {text: ‘large’}] For details: https://github.com/tinymce/tinymce/blob/master/js/tinymce/plugins/link/plugin.js I met the same problem when I want to use select2 in the dialog. All plugins are using listbox. My guess is they always use listbox instead of selectbox. And the handler for selectbox is broken.

Custom URL going to 404

Redirect early First of all, your redirect function should be hooked early: you are not relying on query variables there, so you could use init hook: function search_redirect() { if (!empty($_GET[‘s’])) { $home = trailingslashit(home_url(‘catalog-of-work’)); wp_safe_redirect($home.urlencode(get_query_var(‘s’))); exit(); } } add_action(‘init’, ‘search_redirect’); The reason is that this will redirect the request much earlier, saving a lot … Read more

How to remove the search fields in Twentytwelve

get_search_form() displays the search form. So you can either remove it or comment it out. My advice would be to create a child theme, copy the necessary template files you would need working on and edit them so your customization’s don’t get overwritten on theme update.

Can not sanitize select control in customize api

The add_setting logic cant find the my_theme_sanitize_select function, you need to tell it where it is: ‘sanitize_callback’ => array( $this, ‘my_theme_sanitize_select’ ), remember that your function is inside a class so it cant just be accessed, add this to your class: public function my_theme_sanitize_select( $input, $setting ) { $from_parent = my_theme_sanitize_select( $input, $setting ); return … Read more

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