Concatenate site_url and string doesn’t work

I’m trying to concatenate my site_url and a string, but it doesn’t work. This is what I’m doing: $myurl = site_url(); var_dump($myurl); $url = “https” . $myurl . “/inbox/?fepaction=viewmessage&fep_id=” . $inserted_message->ID; var_dump($url); die; The output looks like this: string(31) “//zgp.mydomain.be” string(78) “https:/inbox/?fepaction=viewmessage&fep_id=4813” As you can see it isn’t merged. How can this be? 3 Answers … Read more

How to get “extended” path info from URL in a plugin

Working on a plugin that creates short codes to embed into a page. I have permalinks set to “Post name”, so http://example.com/post-name/ I want to be able to pass additional information in the URL so the short code can use it, for example: http://example.com/foo-page/bar-thing/ as opposed to ?name=value On our dev servers, this works and … Read more

Add custom URLs to WordPress’s XML sitemap

My WordPress site also incorporates some external non-WP content that is dynamically pulled into the page via shortcode. The content shown depends on a query string parameter. So from WP’s point of view, index is just a single page containing a shortcode; but in reality, when you visit index?x=1, index?x=2, index?x=3, etc. you get different … Read more

Escaping ampersand in URL

I am trying to send a GET message that contains strings with ampersands and can’t figure how to escape the ampersand in the URL. Example: http://www.example.com?candy_name=M&M result => candy_name = M I also tried: http://www.example.com?candy_name=M\&M result => candy_name = M\\ I am using URLs manually, so I just need the correct characters. I can’t use … Read more

query_vars Filter: Would You Ever Use It When $_GET is Available and You Don’t Need a ‘Pretty’ URL?

I’m having a hard time wrapping my head around the uses cases/best practice for the ‘query_vars’ filter, and query_vars in general, when I could use the $_GET global instead. Given http://example.com/my-page/?mykey=myvalue: If I’m not altering the query, I understand that it wouldn’t be appropriate to add ‘mykey’ as a query var. But if I AM … Read more

Showing random content / pictures from earlier posts in a sticky post?

I have a sticky post on my wordpress blog, in the beginning. I would like to place some random content in it, by simply replacing some HTML in the post content. The random content would come from earlier posts. For doing this I edited my template’s “blog.php” file, to interact with the main wordpress loop. … Read more

Query string becomes encoded when a static page is used as homepage

In the WordPress Admin ‘Reading Settings’ under the ‘Your home page displays’ option, when a static page is selected as Homepage, it appears that any query string with special characters added to the URL of the base site becomes encoded. Using an example URL, if the option was set to ‘Your latest posts’, I get … Read more

Is doing_wp_cron a necessary query string when scheduling cron.php as a cron job?

I have seen various ways to schedule the WordPress cron so that it is triggered by the server. Some will run the php file directory from the crontab and others will use a wget and reference the url. I have noticed some sites suggesting this: wget -q -O – https://domain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1 What is the … Read more

Get escaped URL parameter

I’m looking for a jQuery plugin that can get URL parameters, and support this search string without outputting the JavaScript error: “malformed URI sequence”. If there isn’t a jQuery plugin that supports this, I need to know how to modify it to support this. ?search=%E6%F8%E5 The value of the URL parameter, when decoded, should be: … Read more