Get arguments from URL
Your URL querystring is malformed. ? good before the first variable. & goes before any others. Your url should be http://mysite/login?user_id=6&category=3
Your URL querystring is malformed. ? good before the first variable. & goes before any others. Your url should be http://mysite/login?user_id=6&category=3
You could add a setting using add_option( ‘access_keys’, [ ‘key_1’, ‘key_2 ] ) to check against when loading the page. add_action( ‘init’, ‘wpse339612_check_access_codes’ ); function wpse339612_check_access_codes(){ if( isset( $_GET[‘key’] ) ){ $available_keys = get_option( ‘access_keys’ ); $key_index = array_search( filter_var( $_GET[‘key’], $available_keys ); if( $key_index !== false ){ /*User has access! Delete the key from … Read more
You can use conditional tag is_404() and wp action hook to redirect whenever the page can not be found. functions.php add_action( ‘wp’, ‘se344018_redirect_404’ ); function se344018_redirect_404() { if ( is_404() ) { wp_redirect( home_url() ); // // wp_redirect( home_url(‘some/page-slug’) ); exit; } }
Spammers use the URL of unapproved comments to share around the Internet. This makes the comments viewable until the comment is dealt with via approval process. WordPress’ contributors are working on a patch for the next version. https://core.trac.wordpress.org/ticket/49956
I can guarantee that somewhere on your technology stack (edge CDN, Firewall, Web Server, WordPress Plugin) that you have something configured that throws a 403 error whenever you try to access a URL on your site without the User-Agent Header set. Hence why it works when you access in the browser (as this will contain … Read more
This post provides a function, but it cannot handle non-latin characters. That’s because URLs can’t have non-latin/ASCII characters. Browsers might show non-latin characters to you, but it’s just a user interface feature. For example, if you visit this Wiktionary URL: https://en.wiktionary.org/wiki/わかもの#Japanese, you browser URL encodes the japanese characters to get the real URL: https://en.wiktionary.org/wiki/%E3%82%8F%E3%81%8B%E3%82%82%E3%81%AE#Japanese then … Read more
You could try this instead if (!is_front_page() && is_home()) { get_template_part(‘template-parts/blog-categories’); } Explanation for the difference between front_page an home is here: https://wordpress.stackexchange.com/a/239838 if you set a page as a blog-page it is “home”, in your case the landing-page is the so called “front_page”. This is WordPress specific.
Ok got it, knew there must be some built-in WP solution to this. Simply call wp_get_referer() in your callback (for details, see this). At least it’s working as I need it, let me know if there’s any better solution. UPDATE Thanks to @Tom J Nowell, we should also mention that referrers could get stripped for … Read more
The Codex example for home_url() says you want home_url( “https://wordpress.stackexchange.com/” ) to get the blog’s URL with a trailing slash. Alternatively you could use trailingslashit( home_url() ). That may be safer if your site’s home option somehow ends up stored with a trailing slash, since it looks like get_home_url() assumes it isn’t, but that ought … Read more
What you are asking for is impossible, and if SEO consultants are asking for this then they do not know what they’re talking about. WordPress is not redirecting you to a non-slashed homepage, the change happens before your browser even starts the request. To understand why, take a look at one of the most basic … Read more