Can’t pass table to $wpdb->prepare

The prepare() method escapes %s. The second piece of code you listed breaks because quotation marks are added to the table name, hence it doesn’t match what’s in the DB. The first piece of code works because it’s a straight string replacement hence matching the name of the table in the database. What is the … Read more

Prevent redirect to page/page when reserved term ‘name’ in $_POST when value is a page/post title

I would actually suggest an alternative approach – remove the function that causes the redirect in the first place: function wpse_227033_disable_name_redirect() { if ( is_404() && isset( $_GET[‘name’], $_GET[‘instID’] ) ) remove_action( ‘template_redirect’, ‘redirect_canonical’ ); } add_action( ‘wp’, ‘wpse_227033_disable_name_redirect’ ); I’ve used the wp hook which runs pretty much just before template_redirect. Remember you’ll need … Read more

Pass query string to page

This should actually work for you: function header_resized_img () { $image = wp_get_image_editor($_GET[‘path’]); $height = $_GET[‘height’]; $width = $_GET[‘width’]; if (!is_wp_error($image)) { $image->resize(9999, $height, false); $orig_size = $image->get_size(); $image->crop($orig_size[‘width’]/2-$width/2, $orig_size[‘height’]/2-$height/2, $width, $height); $image->stream( $mime_type=”image/jpeg”); } } and include your function somewhere in the template: header_resized_img(); Then try accessing this URL: http://example.com/image/?width=500&height=400&path=some-url To generate your image.

How can I Rewrite a ‘page’ URL based on query string parameters?

You can add a rewrite rule such as the following. Make sure to register your public query vars with WordPress so it recognizes your rewrite rule vars. add_rewrite_rule(‘^(tips)/([^/]*)/([^/]*)/?’, ‘index.php?name=$matches[1]&id=$matches[2]&filter_id=$matches[3]’,’top’); add_filter(‘query_vars’, ‘foo_my_query_vars’); function foo_my_query_vars($vars){ $vars[] = ‘id’; $vars[] = ‘filter_id’; return $vars; } Visit the Permalinks Settings page to flush your permalinks. You can access your … Read more

How to remove query string from static resources

It looks like you are using JetPack’s Photon which adds query strings to your URLs. According to this thread there is no way to remove them https://wordpress.org/support/topic/how-to-remove-photon-query-string?replies=2 If you want to get rid of the query strings I would suggest deactivating photon, using a CDN which does not add query strings, and using the snippet … Read more

How to get a URL parameter from a URL with get_query_var?

I managed to find a solution with some help from some developers at the theme.co apex forum. I needed to get two query strings from my URL www.randompage.com/tokensuccess/?token=token&username=username called token and username. In order to get this I added the following code to the functions.php code: function add_query_vars_filter( $vars ){ $vars[] = “token”; $vars[] = … Read more

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