I’ve installed GTranslate, It has traslated everything ok less headers, I don’t know why but It can’t translate it, is like invents it. I work with Salient and Bakery.
Exemple:
EN: “Tecnology events.”
French or any language: “Yomporlstondeither andvandnteithers mandmeitherrtoblands ceithern tandcneitherleithergYoto dand vtongortordYoto”
I can’t share the link because I work in Local.
Thanks.
]]>Thank-you
]]>Author icons not full in the circles.
Example: https://prnt.sc/2gJZ0wlTCROk
I noticed some strange errors popping up over my Dashboard:
.../wp-content/plugins/burst-statistics/burst.php):
Failed to open stream: No such file or directory in /.../wp-includes/functions.php on line 6855
Warning: file_get_contents(/.../wp-content/plugins/burst-statistics/burst.php):
Failed to open stream: No such file or directory in /.../wp-includes/functions.php on line 6855
Warning: file_get_contents(/.../wp-content/plugins/webp-uploads/load.php):
Failed to open stream: No such file or directory in /.../wp-includes/functions.php on line 6855
Warning: file_get_contents(/.../wp-content/plugins/health-check/health-check.php):
Failed to open stream: No such file or directory in /.../wp-includes/functions.php on line 6855
Warning: file_get_contents(/.../wp-content/plugins/health-check/health-check.php):
Failed to open stream: No such file or directory in /.../wp-includes/functions.php on line 6855
Warning: Cannot modify header information - headers already sent by (output started at /.../wp-includes/functions.php:6855)
in /.../wp-admin/includes/misc.php on line 1439
Warning: Cannot modify header information - headers already sent by (output started at /.../wp-includes/functions.php:6855)
in /.../wp-includes/functions.php on line 7099
Warning: Cannot modify header information - headers already sent by (output started at /.../wp-includes/functions.php:6855)
in /.../wp-admin/admin-header.php on line 9
and over some Premium Plugins Detail Pages in my Plugin Folder:
Warning: file_get_contents(/.../wp-content/plugins/complianz-gpdr-premium): Failed to open stream: No such file or directory in /.../wp-includes/functions.php on line 6855
I checked my functions.php and they all seem to be “reading header Information”. I used the troubleshooting mode of the Health Check Plugin and the Error only came up with the Security & Malware scan by CleanTalk Plugin.
How can I solve this or is it something for the next update?
Best Regards.
]]>I am trying to modify http headers with your plugin.
So, I have created a simple snippet which do this:
add_filter('wp_headers', 'my_custom_headers');
function my_custom_headers($headers) {
// Add X-XSS-Protection header
if (!isset($headers['X-XSS-Protection'])) {
$headers['X-XSS-Protection'] = '1; mode=block;';
}
// Add X-Content-Type-Options header
if (!isset($headers['X-Content-Type-Options'])) {
$headers['X-Content-Type-Options'] = 'nosniff';
}
return $headers;
}
But, $headers variables only contain “Content-Type” value.
In fact I would like to be able to check if headers have already being sent (from .htaccess by example) and be able to modify them.
So, what is the way to get http headers in order to control them with WPCode snippet?
Thanks in advance for your help and have a nice day.
]]>Header always set Permissions-Policy: "geolocation=(self), microphone=();"
]]>I have a situation where I am attempting to combat nonces getting cached.
To help with this, I setup an endpoint like so:
function generate_nonce(WP_REST_Request $request) {
$nonce = wp_create_nonce('wp_rest');
$response = array(
'nonce' => $nonce
);
return rest_ensure_response($response);
}
I am then calling this in Javascript to get a nonce, before trying to access another endpoint:
<script>
async function fetchNonce() {
try {
const response = await fetch('/wp-json/test/v1/nonce');
if (!response.ok) {
throw new Error('Network response was not ok ' + response.statusText);
}
const data = await response.json();
console.log('Nonce:', data.nonce);
return data.nonce;
} catch (error) {
console.error('Error fetching nonce:', error);
return null;
}
}
async function fetchAllPosts(nonce) {
try {
const response = await fetch('/wp-json/test/v1/posts', {
method: 'GET',
headers: {
'X-WP-Nonce': nonce
}
});
if (!response.ok) {
throw new Error('Network response was not ok ' + response.statusText);
}
const data = await response.json();
console.log('Posts:', data);
} catch (error) {
console.error('Error fetching posts:', error);
}
}
async function executeFetches() {
const nonce = await fetchNonce();
if (nonce) {
await fetchAllPosts(nonce);
} else {
console.error('Failed to fetch nonce.');
}
}
document.addEventListener('DOMContentLoaded', () => {
executeFetches();
});
</script>
This is just to give an idea about the scenario. Getting all posts is just an example to demonstrate.
Anyway.
The test endpoints are like this:
add_action('rest_api_init', 'my_custom_endpoints');
function my_custom_endpoints() {
register_rest_route('test/v1', '/nonce', array(
'methods' => 'GET',
'callback' => 'generate_nonce',
'permission_callback' => '__return_true',
));
// Endpoint for getting all posts
register_rest_route('test/v1', '/posts', array(
'methods' => 'GET',
'callback' => 'get_all_posts',
'permission_callback' => '__return_true',
));
}
This works all well and good for logged out user, as the nonce is valid as through some research it the wp_rest nonce uses user id by default for logged out user or some such?
But as soon as a logged in user tries to generate a nonce through the endpoint and Javascript, error 403 is given even though a nonce is passed and gets created. Real headache causing and frustrating.
Is there any direction this can be managed, or is it entirely a wrong direction?
Thank you.
Here is the get_all_posts as well if it provides some information:
function get_all_posts(WP_REST_Request $request) {
$nonce = $request->get_header('X-WP-Nonce');
if (!wp_verify_nonce($nonce, 'wp_rest')) {
return new WP_Error('rest_invalid_nonce', __('Invalid nonce'), array('status' => 403));
}
// Arguments for WP_Query to fetch all posts
$args = array(
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => -1, // Retrieve all posts
);
// Fetch the posts
$query = new WP_Query($args);
$posts = array();
// Check if there are posts
if ($query->have_posts()) {
// Loop through posts and prepare data
while ($query->have_posts()) {
$query->the_post();
$posts[] = array(
'id' => get_the_ID(),
'title' => get_the_title(),
'content' => get_the_content(),
'excerpt' => get_the_excerpt(),
'date' => get_the_date(),
'author' => get_the_author(),
'link' => get_permalink()
);
}
// Restore original Post Data
wp_reset_postdata();
}
// Return the response as JSON
return rest_ensure_response($posts);
}
]]>