Adding a query string to only one page url

You can filter page_link to modify the output of any page’s permalink value. The simplest way to identify the page is by ID, then you can append the query string via add_query_arg: function wpd_append_query_string( $url, $id ) { if( 42 == $id ) { $url = add_query_arg( ‘ngg_force_update’, 1, $url ); } return $url; } … Read more

How to make pages slug have priority over any category

You can hook onto parse_request and trick WordPress into thinking it matched a page permalink if one exists with the same slug for a category term: /** * Override query for pages that match a category slug. * * @param WP $wp */ function wpse_177014_category_to_page ( $wp ) { if ( ! empty( $wp->query_vars[‘category_name’] ) … Read more

Using esc_url_raw with protocols properly

You are execpeting a WP Error object if the URL has a non-valid protocol but esc_url_raw returns an empty string in that case (see codex), not a WP Error object. So, is_wp_error( $escaped ) never verifies. Also, you are checking an undefined $escaped variable (note that the value of esc_url_raw is stored in $sanitized variable): … Read more

How to pass a PHP $_GET variable and fetch/output it?

get_query_var() only works with the Core WP_Query object: Retrieve public query variable in the WP_Query class of the global $wp_query object. https://codex.wordpress.org/Function_Reference/get_query_var Your mistake is a simple PHP one: The key is foo, not bar. $foo = $_GET[‘foo’]; echo $foo; But please do not echo user supplied data to the page without sanitizing it.

Open editor post in a popup

You need to tell get_edit_post_link to not use the ampersands as specified in the codex. Try this instead: var pop = window.open(‘ <?php echo get_edit_post_link(get_the_ID(), ”); ?> ‘, ‘_blank’, ‘screenX=200,screenY=200,width=1000,height=600’);

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