tarhe
Forum Replies Created
-
Presently they’re working on the clone – https://gla-debugging.mystagingwebsite.com the redirect is not there on the clone.
I’m not sure they deactivated the RankMath plugin yet on the live site as they’re still testing from the staging site. I can still see the redirection header set by RankMath from the header you shared:
x-redirect-by: Rank MathHi @sabbir37,
Does the above URL’s still redirects for you?
Redirection is no longer active, both URLs above now return a 200 response when I ran a cURL on them, and they are not redirecting with a 301 status.
If the issue still persists for you, try visiting the site in incognito mode or from another browser, as you might be experiencing the redirection due to caching.
Hope that helps!
hi @sabbir37
According to the cURL response
curl -LI greenleafair.com/just/testing/sitefor your site the301 redirectionis set by Rank Math plugin – x-redirect-by: Rank Math
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Wed, 09 Apr 2025 17:38:35 GMT
Content-Type: text/html
Content-Length: 162
Connection: keep-alive
Location: https://greenleafair.com/just/testing/site
Alt-Svc: h3=":443"; ma=86400
HTTP/2 301
server: nginx
date: Wed, 09 Apr 2025 17:38:38 GMT
content-type: text/html; charset=UTF-8
location: https://greenleafair.com
strict-transport-security: max-age=31536000
host-header: wpcloud
vary: Cookie
expires: Wed, 11 Jan 1984 05:00:00 GMT
cache-control: no-cache, must-revalidate, max-age=0
x-nitro-cache: MISS
x-nitro-disabled-reason: 404
x-nitro-disabled: 1
x-redirect-by: Rank MathForum: Fixing WordPress
In reply to: Google Indexation Problem caused by redirectGreat, the new shop page – curl -LI https://boehne-immobilien.de/midmade-bodentreppen/ is accessible now.
You’ll need to go to your Google search console and Ask Google to recrawl your site URLs Google crawler should re-crawl and index your site pages including the new shop page.Forum: Fixing WordPress
In reply to: Google Indexation Problem caused by redirectI checked the home-4 and Shop URL https://boehne-immobilien.de/shop/ header request response, I do see it’s 404ing from the response below this means the there is no Shop page on your site does not exist.
HTTP/2 404
expires: Wed, 11 Jan 1984 05:00:00 GMT
cache-control: no-cache, must-revalidate, max-age=0
link: <https://boehne-immobilien.de/wp-json/>; rel=”https://api.w.org/”
vary: User-Agent
content-type: text/html; charset=UTF-8
date: Wed, 29 Jan 2025 16:22:45 GMT
server: Apache
If you can access the page when you’re logged in you might need to reset the site permerlinks by re-saving the current settings there then try visiting the shop URL when you’re not logged in to see if you’re able to access the page. Else you might need to fix the issue on why your shop page is 404ing.Forum: Fixing WordPress
In reply to: Cannot replace an image in Media LibraryHi @chcw
If you’ve replaced the images successfully, you might still need to flush your site’s cache. If you’re using WP Rocket for caching, try visiting the image URL in incognito mode or from another browser to check if you can see the updated version. Alternatively, you can append
?nocache=123to the end of the image URL to bypass cached versions of the page.If you’re able to see the updated images this way, it likely means you’re experiencing a browser caching issue.
Best,
Tarhe
Forum: Developing with WordPress
In reply to: XML with api to wordpressYou can add the above from the main plugin file i would also advice leaving the MINUTE_IN_SECONDS to around 20 mins so you don’t get rate limited by the API for making too many request within a short time.
You can download the updated plugin here.
Forum: Developing with WordPress
In reply to: XML with api to wordpressHow can we reset the update time to 2 min.
To reset the cache update time to 2 minutes, you need to adjust the cache expiration value in the code. Change the
cache_expirationvariable to useMINUTE_IN_SECONDS * 2, which will set it to 2 minutes.And one more question where do i have to put the css script in to elementor
You don’t need to put any CSS into Elementor. All CSS needs to go inside the php code or added separately inside the plugin files which is usually the best practice then you can enqueue the css file from the php code.
To make it easier for you I’ve update the plugin again which you can download here to show this structure as it should be and also update the time to 2 min. please work to modify the plugin to meet any specification you’d like. The styling should look nice at least for now until you update it further to meet your needs.
- This reply was modified 1 year, 7 months ago by tarhe.
Forum: Developing with WordPress
In reply to: XML with api to wordpressYou can add styling and like CSS and HTML to make it look the way you want as i’ve done below. When you have the time you can also hire a developer to style the plugin to meet your site specification. You can download the modification which i added the space here.
<?php
/*
Plugin Name: ANWB Traffic Info
Description: Displays live traffic information from ANWB API using an API key.
Version: 1.2
Author: Goos
*/
function fetch_and_display_anwb_traffic_info() {
// Define the cache key and expiration time
$cache_key = 'anwb_traffic_info_cache';
$cache_expiration = HOUR_IN_SECONDS; // Cache duration (1 hour)
// Try to get the cached data
$cached_data = get_transient($cache_key);
if ($cached_data !== false) {
// Return the cached data if it exists
return $cached_data;
}
$api_url = 'https://cris-admin.anwb.nl/export-api/v1/pqfeed/latest';
$api_key = 'ADD-YOUR-API-KEY-HERE';
// Set up the request with the API Key in the headers
$response = wp_remote_get($api_url, [
'headers' => [
'x-api-key' => $api_key
]
]);
if (is_wp_error($response)) {
return 'Error retrieving traffic data: ' . $response->get_error_message();
}
$xml_data = wp_remote_retrieve_body($response);
// Check if we have data
if (empty($xml_data)) {
return 'No data received from the API.';
}
// Parse the XML response
$xml = simplexml_load_string($xml_data);
if (!$xml) {
return 'Error parsing traffic data.';
}
// Start output buffer to capture HTML content
ob_start();
echo '<div class="anwb-traffic-info">';
foreach ($xml->Sections->Section->Messages->Message as $message) {
// Check if FullText field exists and is not empty
if (!empty($message->FullText)) {
echo '<div class="traffic-message">';
// Display the road sign (road name) in a separate box
if (!empty($message->Road)) {
echo '<div class="road-sign">' . esc_html($message->Road) . '</div>';
}
// Display the main location and direction in a separate row
if (!empty($message->MainLocation)) {
echo '<div class="location-direction">' . esc_html($message->MainLocation);
if (!empty($message->From)) {
echo ' richting ' . esc_html($message->From);
}
echo '</div>';
}
// Display hectometer detail if available
if (!empty($message->Hectometer)) {
echo '<div class="hectometer">Hectometerpaal: ' . esc_html($message->Hectometer) . '</div>';
}
// Display the full traffic message text
echo '<div class="message-content">' . esc_html($message->FullText) . '</div>';
echo '</div><hr>';
}
}
echo '</div>'; // Close main container
// Get buffer contents and clean buffer
$output = ob_get_clean();
// Cache the output for future requests
set_transient($cache_key, $output, $cache_expiration);
return $output;
}
// Register a shortcode to display the data on any page/post
add_shortcode('anwb_traffic_info', 'fetch_and_display_anwb_traffic_info');Forum: Developing with WordPress
In reply to: XML with api to wordpressYes, since the XML data from the API contains a
<FullText>field that includes the primary information you want to display, then accessing$message->FullTextis the way to go.Forum: Developing with WordPress
In reply to: XML with api to wordpressGood to know you were able to get the plugin to work to modify the plugin to display only the
FullTextfield from each traffic message, you can update theforeachloop to check specifically for that field.
You can download the new modified plugin here that will display theFullTextfield only. You just need to update the previous plugin with this new version to see only theFullTextfield on the response.Forum: Developing with WordPress
In reply to: XML with api to wordpressLook like the link got expired. Please download here as soon as you can before it expires again.
Forum: Developing with WordPress
In reply to: XML with api to wordpressPlease follow the steps below to use the plugin.
- Download the plugin from here – https://file.io/RfKuedub1CqT
- Install and activate the plugin from WordPress admin > plugins
- Add this shortcode
[anwb_traffic_info]on elementor with the steps here to any of your page/post and save your page
Once you follow the above process you see the traffic data displaying on the page/post you added it to.
Forum: Developing with WordPress
In reply to: XML with api to wordpressYou can follow the steps here on the link to add a shortcode on your page/post from Elementor.
I hope that helps 🙂
Forum: Developing with WordPress
In reply to: XML with api to wordpressHi @meganmante
We’re unable to help further than this but for now the plugin above should work 90% to output the response from the above API when you install the plugin add the shortcode
[anwb_traffic_info]to any page or post where you want the traffic data to appear.You’re welcome to reach out to a developer to help expand the functionality further, just wanted to demonstrate how you can make it work.