most recent 30 from stackoverflow.com2026-02-01T07:25:32Zhttps://stackoverflow.com/feeds/tag?tagnames=wordpresshttps://creativecommons.org/licenses/by-sa/4.0/rdfhttps://stackoverflow.com/q/331444300ejaz alihttps://stackoverflow.com/users/54487602015-10-15T09:14:51Z2026-01-31T22:44:29Z
<p>In my WordPress, when I open the media library, it shows all the images in the media library. But whenever I try to add new pictures in any post/page/form and proceed to insert media from the library, it does not show any image and continuously reading gallery.</p>
<p><a href="https://i.sstatic.net/cWKgM.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/cWKgM.png" alt="enter image description here"></a></p>
https://stackoverflow.com/q/663120070drimkhttps://stackoverflow.com/users/31485592021-02-22T08:05:20Z2026-01-31T03:57:03Z
<p>My website home page returns "ERR_INVALID_REDIRECT". All the other pages of the website are fine. It just returns this issue for the Homepage (meaning: <a href="https://www.mywebsiteurl.com/" rel="nofollow noreferrer">https://www.mywebsiteurl.com/</a>).</p>
<p>The reason is that Wordpress decides to redirect to "https:///" (cf. screenshot below: X-redirect-by: Wordpress)</p>
<p><a href="https://i.sstatic.net/WpNpG.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/WpNpG.png" alt="enter image description here" /></a></p>
<p>I have already:</p>
<ul>
<li>Cleared my browser cache</li>
<li>Restarted Nginx, Varnish and Apache</li>
<li>Deactivated the plugins from wordpress</li>
<li>in my wp-config.php file the WP_HOME and WP_SITEURL are set properly.</li>
</ul>
<p>I did just upgraded to Wordpress: 5.6.1 and also updated my Theme yesterday. There was no problem before the upgrade. So the problem is certainly coming from one of these actions.</p>
<p>My question is, What else should I check?
What are the next actions that I could take the figure out where the problem comes from? Any advanced debugging I could do somehow?</p>
<p>Thanks a lot.</p>
<p>UPDATE #1</p>
<p>Mywebsite.conf</p>
<pre><code><VirtualHost *:8080>
ServerName www.mywebsite.com
DocumentRoot /var/www/wordpress/
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{User-agent}i\"" varnishcombined
ErrorLog /var/log/apache2/wordpress/mywebsite-error.log
CustomLog /var/log/apache2/wordpress/mywebsite-access.log varnishcombined
</VirtualHost>
</code></pre>
<p>wordpress.conf</p>
<pre><code><Directory /var/www/wordpress/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<VirtualHost *:80>
ServerName 139.162.xx.xx #I masked the IP here
#Redirect permanent / http://www.mywebsite.com/
ServerAdmin webmaster@localhost
DocumentRoot /var/www/wordpress/
ErrorLog /var/log/apache2/wordpress/error.log
CustomLog /var/log/apache2/wordpress/access.log combined
<files xmlrpc.php>
order allow,deny
deny from all
</files>
</VirtualHost>
</code></pre>
<p>The last virtual host from wordpress.com should not be taken in to account because Apache just listens on port 8080.
Nginx, my front webserver listens on port 80 and 443.</p>
<p>UPDATE #2</p>
<p>mywebsite.conf (Nginx conf)</p>
<pre><code>server {
listen 443;
server_name www.mywebsite.com;
port_in_redirect off;
ssl on;
ssl_certificate /etc/ssl/private/mywebsite.com.chained.crt;
ssl_certificate_key /etc/ssl/private/mywebsite_com_key.txt;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!dSS;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:20m;
ssl_session_timeout 60m;
add_header Strict-Transport-Security "max-age=31536000";
add_header X-Content-Type-Options nosniff;
location / {
proxy_pass http://127.0.0.1:6081;
proxy_read_timeout 90;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Port 443;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header HTTPS "on";
}
}
server {
listen 443 ssl;
server_name mywebsite.com;
return 301 https://www.mywebsite.com$request_uri;
}
server {
listen 80 default_server;
server_name _;
return 301 https://$host$request_uri;
}
</code></pre>
<p>UPDATE #3</p>
<pre><code> #curl -v -H 'Host: www.mywebsite.com' http://127.0.0.1:8080/
* Expire in 0 ms for 6 (transfer 0x56356f708f50)
* Trying 127.0.0.1...
* TCP_NODELAY set
* Expire in 200 ms for 4 (transfer 0x56356f708f50)
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET / HTTP/1.1
> Host: www.mywebsite.com
> User-Agent: curl/7.64.0
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Date: Wed, 24 Feb 2021 14:32:06 GMT
< Server: Apache/2.4.38 (Debian)
< X-Redirect-By: WordPress
< Location: https://www.mywebsite.com/
< Content-Length: 0
< Content-Type: text/html; charset=UTF-8
<
* Connection #0 to host 127.0.0.1 left intact
</code></pre>
https://stackoverflow.com/q/798783332unity-studenthttps://stackoverflow.com/users/197360562026-01-28T23:04:19Z2026-01-30T23:08:25Z
<p>I have dynamic text that Loco Translate isn't recognizing.I added the text myself to a plugin file I downloaded from the WordPress repository.I ran several different tests; I'll only include two here to keep it brief.</p>
<p>This is the first one I tried:</p>
<pre><code>// We rendered the requested dynamic title.
echo '<h2 class="product-results-page-title" style="margin-bottom: 30px; text-align: left;">';
echo sprintf(
/* translators: 1: cantidad de productos, 2: lista de alérgenos */
/* translators: %$s: Number of products found */
_n(
'This is the %1$s product without %2$s',
'These are the %1$s products without %2$s',
$count,
'product-search-for-woocommerce'
),
'<strong>' . (int) $count . '</strong>',
'<span class="product-search-name">' . esc_html($list_text) . '</span>'
);
echo '</h2>';
echo '</h2>';
</code></pre>
<p>It doesn't recognize this one</p>
<pre><code> // 1. We prepared the text to be translated in isolation so that Loco could see it clearly.
$texto_singular = 'This is the %1$s product without %2$s';
$texto_plural = 'These are the %1$s products without %2$s';
// 2. We obtain the translation (using the $count variable for the plural)
$mensaje_traducido = _n( $texto_singular, $texto_plural, (int) $count, 'product-search-for-woocommerce' );
// 3. We render safely
echo '<h2 class="product-results-page-title" style="margin-bottom: 30px; text-align: left;">';
echo sprintf(
$mensaje_traducido,
'<strong>' . (int) $count . '</strong>',
'<span class="product-search-name">' . esc_html( $list_text ) . '</span>'
);
echo '</h2>';
</code></pre>
<p>It doesn't recognize this one either.</p>
<p>What am I doing wrong?</p>
https://stackoverflow.com/q/79879521-1Tonyhttps://stackoverflow.com/users/67699372026-01-30T15:31:23Z2026-01-30T22:48:56Z
<p>See comment in the code:<br />
// Here I want to attach som text to checkout page under order review table for this specifik product id 7498 if quantity is 1
I have in the code bellow tried many things in javascript, but I wanna do It in PHP.</p>
<pre><code> add_action( 'woocommerce_before_cart', 'bbloomer_find_product_in_cart_alt' );
function bbloomer_find_product_in_cart_alt() {
$product_id_7498 = 7498;
$product_id_7475 = 7475;
$quantity1 = 1;
$quantity2 = 2;
$in_cart = false;
foreach( WC()-\>cart-\>get_cart() as $cart_item ) {
$product_in_cart = $cart_item\['product_id'\];
//$quantity_items = $cart_item\['quantity'\];
//$item_quantity += $item-\>get_quantity();
//echo $quantity_items;
//$product_in_cart = $cart_item\['data'\];
//echo $products_in_cart;
//echo $cart_item\['product_id'\] . "\<br\>";
//echo $cart_item\['quantity'\] . "\<br\>";
//echo var_dump($products_in_cart) . "\<br\>";
if ( $product_in_cart === $product_id_7498 ) {
$in_cart = true;
echo "Yes produkt 7498 finns i varukorgen . \<br\>";
$product_quantity_7498 = $cart_item\['quantity'\];
echo "Produkt 7498 / antal: " . $product_quantity_7498 . "\<br\>";
if ($product_quantity_7498 === 1) {
echo "Produkt 7498 antal är 1 . \<br\>";
// Here I want to attach som text to checkout page under order review table for this specifik product id 7498 if quantity is 1
}
if ($product_quantity_7498 === 2) {
echo "Produkt 7498 antal är 2 . \<br\>";
// Here I want to attach som text to checkout page under order review table for this specifik product id 7498 if quantity is 2
}
}
if ( $product_in_cart === $product_id_7475 ) {
$in_cart = true;
echo "Yes produkt 7475 finns i varukorgen . \<br\>";
$product_quantity_7475 = $cart_item\['quantity'\];
echo "Produkt 7475 / antal: " . $product_quantity_7475 . "\<br\>";
}
}
}
</code></pre>
https://stackoverflow.com/q/798757940Vinit Laddhahttps://stackoverflow.com/users/322586082026-01-25T16:28:18Z2026-01-30T20:14:35Z
<p>I have a question regarding layout structure in <strong>WordPress Elementor</strong>.</p>
<p>In my team, my seniors recommend continuing to use <strong>Sections and Columns</strong>, stating that sections provide better responsiveness. Their main reasoning is that the existing website has been built using sections for a long time, so we should maintain consistency and continue using the same approach for new pages.</p>
<p>However, after researching Elementor’s recent updates and documentation, I found that <strong>Containers (Flexbox)</strong> are officially recommended by Elementor and are generally considered more efficient and responsive compared to sections. Containers also seem to offer better performance, cleaner structure, and more control over responsive layouts.</p>
<p>My question is:</p>
<ul>
<li><p>From a technical and best-practice perspective, are <strong>Containers actually better than Sections</strong> for responsiveness and performance?</p>
</li>
<li><p>Is there any valid technical disadvantage in using containers for <strong>new pages</strong>, even if older pages are built with sections?</p>
</li>
<li><p>Or is sticking to sections purely a legacy/consistency decision rather than a responsiveness limitation?</p>
</li>
</ul>
<p>I would appreciate insights from experienced Elementor users or developers who have worked with both approaches.</p>
<p>Thank you.</p>
https://stackoverflow.com/q/79878118-1Jumpy73https://stackoverflow.com/users/109567872026-01-28T16:33:41Z2026-01-30T10:54:22Z
<p>I'm trying to integrate a Google Apps Script (GAS) web app into a WordPress site via an iframe.</p>
<p>The basic integration works, but only with a static iframe height.</p>
<p>To achieve automatic height resize, I tried having the web app communicate with the WordPress page via postMessage and similar logic.</p>
<p>Since then, problems have appeared: sandboxing, CORB, GAS internal script blocking, Google-generated security iframe, etc.</p>
<p>In practice, GAS prevents any two-way communication between the iframe and the host page.</p>
<p>To circumvent these limitations, I even tried a reverse proxy using Cloudflare Workers to serve the web app from my custom domain.</p>
<p>The proxy technically works, but GAS continues to return its fallback page (with internal iframe and goog.script.init script) instead of my web app, as if it weren't executing the user code when the request arrives via a custom domain.</p>
<p>All the questions on similar topics found here are many years old!</p>
<p>At this point, I ask:</p>
<p>Are there any unexplored solutions that allow a GAS web app to be integrated into an external domain with dynamic iframe resizing, or are there architectural alternatives that allow reliable communication between the iframe and the host page?</p>
<p>EDIT: (@snuffy) regarding the using of Iframe resize. Below you can see configuration on GAS side</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false" data-babel-preset-react="false" data-babel-preset-ts="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code><head>
...
<script>
window.iframeResizer = {
license: "GPLv3",
onReady: () => console.log("[GAS] iframe-resizer is ready"),
}
</script>
<script src="https://cdn.jsdelivr.net/npm/@iframe-resizer/child@5.5.7"></script> <!-- JS di iframe-resizer.js -->
...
</head>
<script>
...
// manage dynamic behaviour of the app after DOM loading
document.addEventListener("DOMContentLoaded", async function() {
...
// handshake iframe-resizer iniziale
top.postMessage('gasFrame', '*');
console.log('[GAS] Inviato gasFrame');
});
</script></code></pre>
</div>
</div>
</p>
https://stackoverflow.com/q/798751210Dmitryhttps://stackoverflow.com/users/102402912026-01-24T11:21:18Z2026-01-30T09:51:59Z
<p>I'm using code that displays a pop-up notification about adding a product to the cart.</p>
<pre><code> // Registration of styles and scripts
add_action('wp_enqueue_scripts', 'enqueue_custom_woocommerce_popup_script');
function enqueue_custom_woocommerce_popup_script() {
// Registering Styles
add_action('wp_head', 'custom_popup_css');
// Enabling inline-JS in the footer
add_action('wp_footer', 'custom_popup_js');
}
// CSS output function in head
function custom_popup_css() {
?>
<!-- Custom styles for the popup -->
<style>
.woo-add-to-cart-popup {
position: fixed;
top: 50px;
right: 20px;
background-color: #f8f8f8;
color: black;
padding: 10px 20px;
border-radius: 5px;
font-size: 14px;
z-index: 9999;
transition: opacity 0.5s ease-in-out;
animation: slideInRight 0.5s forwards;
}
@keyframes slideInRight {
from {
transform: translateX(-10%);
opacity: 0;
}
to {
transform: translateX(0);
opacity: 1;
}
}
</style>
<?php
}
// The JavaScript output function immediately before the closing body tag
function custom_popup_js() {
?>
<script>
jQuery(document).ready(function($) {
function showPopup(message) {
const popup = document.createElement("div");
popup.className = "woo-add-to-cart-popup";
popup.textContent = message;
document.body.appendChild(popup);
setTimeout(() => {
popup.style.opacity = "0"; // Smooth fade
setTimeout(() => {
document.body.removeChild(popup); // Removes the element completely after one second.
}, 500); // Waiting time after the start of smooth fading
}, 2000); // The message is displayed for 2 seconds.
}
$('body').on('added_to_cart', function(event, fragments, cart_hash, button) {
let product_name = ''; // Variable for storing the product name
// We check if we are on a single product page
if($(button).closest('.single-product')) {
// If yes, we extract the product name from the H1 heading
product_name = $('.single-product .product_title').text();
} else {
// Otherwise, we consider this to be a shop page.
product_name = $(button).closest('.product').find('.wd-entities-title').text();
}
// Additional check in case of missing text
if(!product_name || product_name.trim().length === 0) {
product_name = $(button).data('product_title') || '';
}
// Displaying a message about adding an item to the cart
showPopup(`"${product_name}" added to cart`);
});
});
</script>
<?php
}
</code></pre>
<p>My website uses the Woodmart theme, which uses different styles for the product title. On the single product page, the notification works correctly, but on the shop page, the product title doesn't appear in the notification.</p>
<p>Here is a screenshot of the HTML structure:
<a href="https://i.sstatic.net/M6vxLFzp.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/M6vxLFzp.jpg" alt="screenshot" /></a></p>
<p>How can I correct my code so that the product title appears in the notification?</p>
https://stackoverflow.com/q/48283929-3user1002601https://stackoverflow.com/users/10026012018-01-16T14:48:58Z2026-01-30T08:02:33Z
<p>This is a WordPress site and errors occurs anywhere at random times while browsing the site or dashboard. It's always the same byte 53248 or 8192. Very small bytes in fact. But there is something else going on there other than insufficient memory.</p>
<p>I guess there is a bug somewhere. It throws the error from <code>/wp-includes/wp-db.php</code> from line 1896:</p>
<pre><code>$num_rows = 0;
if ( $this->use_mysqli && $this->result instanceof mysqli_result ) {
while ( $row = mysqli_fetch_object( $this->result ) ) {
$this->last_result[$num_rows] = $row;
$num_rows++;
}
} elseif ( is_resource( $this->result ) ) {
while ( $row = mysql_fetch_object( $this->result ) ) {
$this->last_result[$num_rows] = $row;
$num_rows++;
}
}
</code></pre>
https://stackoverflow.com/q/79879094-6Diego Waishttps://stackoverflow.com/users/50837562026-01-30T01:23:41Z2026-01-30T01:25:15Z
<p>My WordPress site is built with Divi Builder and Divi Plus. This is the first time this (shortcode displayed on the imagen on the link) appears on the frontend.</p>
<p>I already tried disabling and enabling all the plugins. I’m using Divi Plus and Divi Flash with MemberPress.</p>
<p>This is how the frontend looks:
<a href="https://gyazo.com/8885e1309c9ac4590133afa76eba045a" rel="nofollow noreferrer">https://gyazo.com/8885e1309c9ac4590133afa76eba045a</a></p>
<p>Does anyone know where this could be coming from?</p>
<p>Thanks!</p>
https://stackoverflow.com/q/426278110John Smithhttps://stackoverflow.com/users/73749712017-03-06T14:13:45Z2026-01-30T01:01:30Z
<p>I am trying to implement twitter share on my site. For this i have added these meta tags:</p>
<pre><code><meta property="twitter:card" content="summary_large_image"/>
<meta property="twitter:site" content="@abc"/>
<meta property="twitter:title" content="dummy text"/>
<meta property="twitter:description" content="dummy text"/>
<meta property="twitter:url" content="http://example.com/example"/>
<meta property="twitter:image:src" content="http://example.com/wp-content/uploads/2017/03/example.jpg"/>
<meta property="twitter:domain" content="The Example"/>
</code></pre>
<p>When i am trying to check card preview using twitter card validator. i get this error: ERROR: Fetching the page failed because it's denied by robots.txt.</p>
<p>For fix this issue. I have added these line in robot file on server:</p>
<pre><code>User-Agent: google
User-Agent: googlebot
User-agent: Twitterbot
Crawl-delay: 10
User-agent: *
Disallow: /
</code></pre>
<p>But i am still getting this issue. Please help me to sort out this issue. </p>
https://stackoverflow.com/q/79878830-3ZedORYasuohttps://stackoverflow.com/users/199527532026-01-29T16:23:20Z2026-01-29T21:43:07Z
<p>I built my website with WordPress. When I search for my website (amngroup.se) on Google, the search results display a strange or incorrect favicon (a bird) instead of my own. However, when I visit the website directly, the correct favicon is shown. I also tested using Google's favicon service:</p>
<p><a href="https://www.google.com/s2/favicons?domain=amngroup.se&sz=64" rel="nofollow noreferrer">https://www.google.com/s2/favicons?domain=amngroup.se&sz=64</a></p>
<p>This correctly shows my favicon.</p>
<p>Why does Google Search display a different favicon, and how can I ensure it shows the correct one?</p>
https://stackoverflow.com/q/258096992user2970137https://stackoverflow.com/users/29701372014-09-12T13:40:23Z2026-01-29T18:09:25Z
<p>I am using Wordpress 4.0 with Bootstrap 3.0 and I have just included Font Awesome via the functions.php file. Everything is working fine (I've used the icons for social media etc).</p>
<p>Now, I want to change the "Search" button in the sidebar to a Font Awesome icon (a search icon, instead of button+text). The code in the file wp-includes/general-template.php looks like this:</p>
<pre><code> <label>
<span class="screen-reader-text">' . _x( '', 'label' ) . '</span>
<input type="search" class="search-field" placeholder="' . esc_attr_x( '', 'placeholder' ) . '" value="' . get_search_query() . '" name="s" title="' . esc_attr_x( '', 'label' ) . '" />
</label>
<input type="submit" class="search-submit" value="'. esc_attr_x( 'Search', 'submit button' ) .'" />
</code></pre>
<p>I want just an input field with the icon next to it, like so:</p>
<pre><code> <label>
<span class="screen-reader-text">' . _x( '', 'label' ) . '</span>
<input type="search" class="search-field" placeholder="' . esc_attr_x( '', 'placeholder' ) . '" value="' . get_search_query() . '" name="s" title="' . esc_attr_x( '', 'label' ) . '" />
</label>
<i class="fa fa-search"></i>
</code></pre>
<p>But yeah, this is not working... If I click on the icon, nothing happens. I have tried to put the i class etc into where now is esc_attr_x( 'Search', but that didn't help either.</p>
https://stackoverflow.com/q/499908250Najd Derghamhttps://stackoverflow.com/users/96881832018-04-23T22:29:13Z2026-01-29T14:05:25Z
<p>I have different categories but I want to have an item in my site menu where I will show products on sale in a specific category only instead of all products that are on sale.</p>
<p>I use this code but it shows all products on sale</p>
<pre><code>[sale_products per_page="32"]
</code></pre>
<p>any hints ?</p>
https://stackoverflow.com/q/38677526-1Garry Pettethttps://stackoverflow.com/users/2788162016-07-30T19:01:45Z2026-01-28T23:55:41Z
<p>I am rebooting my blog. I have several hundred posts from my old WordPress blog. Some of these I want to keep, others I want to purge. Is there a desktop app (preferably) or web-based interface that will take my exported WordPress XML file and let me peruse each post before letting me decide which posts to keep and re-export as an XML file?</p>
https://stackoverflow.com/q/798780341MubieSam Linhttps://stackoverflow.com/users/47447562026-01-28T14:38:33Z2026-01-28T20:56:33Z
<p>I'm trying to use the code below to retrieve the currently logged-in user's roles into a hidden field, Custom Value, in Forminator Form. However, after submitting the form, Submission only returns {all_user_roles} instead of the actual user roles. What's wrong with my code ?</p>
<pre><code>add_action('init', function() {
add_filter('forminator_custom_form_submit_field_value', 'inject_user_roles_into_hidden_field', 10, 4);
function inject_user_roles_into_hidden_field($value, $field, $submitted_data, $form_id) {
// Only target this hidden field
if (!isset($field['element_id']) || $field['element_id'] !== 'hidden-9') {
return $value;
}
// WordPress-standard role retrieval (as per StackOverflow best practice)
if (is_user_logged_in()) {
$user = wp_get_current_user(); // WP_User object
$roles = (array) $user->roles; // Always an array
return implode(', ', $roles); // Convert to string
}
return 'guest';
}
});
</code></pre>
https://stackoverflow.com/q/798770470Manan Bohrahttps://stackoverflow.com/users/240367972026-01-27T10:20:13Z2026-01-28T15:28:23Z
<p>I have icon box widget so the title and description dynamic tag are working but when i try to fatch dynamic tag through icon from my acf field so here is no option or icon which help to get icon from acf please guide me how to solve this problem i am using elementor pro and acf or send any link or video or guide</p>
https://stackoverflow.com/q/99381041Alexhttps://stackoverflow.com/users/13006372012-03-30T06:39:41Z2026-01-27T18:04:20Z
<p>I am developing a Wordpress plugin which requires ImageMagick.</p>
<p>I was testing ImageMagick on my server with this code:</p>
<pre><code><?php
/*
Plugin Name: IM Trial
/
add_action('admin_menu','admin');
function admin() {
add_submenu_page( 'options-general.php', 'Watermark', 'Watermark', 'manage_options', 'handle-uploads-admin111', adminxy );
}
function adminxy() {
$input = site_url('/wp-content/plugins/New/earth_310.png');
if($input){
echo 'Input fetched';
}
else{
echo 'Probs';
}
$output = site_url('/wp-content/plugins/New/output.png');
exec("convert $input $output");
exec("/usr/bin/convert $input $output");
}
?>
</code></pre>
<p>I am running my wordpress on Hostgator and they told me that ImageMagick is installed on my server. But, the above code <strong>does not give me any output.</strong> Actually, it should be creating a new image file 'output.png' in /plugins/New folder. But, it is neither giving any error message nor outputting the image.</p>
<p>Is there something I am lacking in the code??? I appreciate any help.</p>
https://stackoverflow.com/q/79877246-1Front- Developer 1989https://stackoverflow.com/users/191119042026-01-27T15:21:10Z2026-01-27T15:21:10Z
<p>WordPress site infected with malware causing redirect to external domain even after disabling plugins and theme</p>
<p>I’m dealing with a persistent malware issue on a WordPress site that redirects all traffic to:</p>
<p><code>https://www1.newsus.app/mpc/</code></p>
<p>Here’s what I’ve already tried and checked:</p>
<ul>
<li><p>The site is hosted on <strong>Hostinger</strong></p>
</li>
<li><p>I reviewed and cleaned:</p>
<ul>
<li><p><code>.htaccess</code></p>
</li>
<li><p><code>index.php</code></p>
</li>
</ul>
</li>
<li><p>The folder <code>/wp-content/mu-plugins/</code> is empty</p>
</li>
<li><p>I renamed the entire <code>/wp-content/plugins/</code> folder (so all plugins are disabled)</p>
</li>
<li><p>I also deactivated and changed the active theme</p>
</li>
<li><p>Even with plugins disabled and the theme changed, the redirect <strong>still happens</strong></p>
</li>
<li><p>I discovered that the original theme (<strong>Impreza – premium, but outdated</strong>) seems to be infected</p>
</li>
<li><p>Cloudflare is enabled, but the redirect still happens even when bypassing cache</p>
</li>
</ul>
<p>The redirect happens immediately when accessing the site, both on frontend and admin.</p>
<p>At this point, I’m suspecting:</p>
<ul>
<li><p>A hidden PHP file injected somewhere else (maybe <code>wp-includes</code>, <code>uploads</code>, or root)</p>
</li>
<li><p>A compromised database option (like <code>siteurl</code>, <code>home</code>, or injected JS/PHP)</p>
</li>
<li><p>Server-level infection or cron job</p>
</li>
</ul>
<p><strong>My questions:</strong></p>
<ol>
<li><p>Where else should I look for hidden malware that survives plugin and theme deactivation?</p>
</li>
<li><p>Are there common places WordPress malware hides that are often overlooked?</p>
</li>
<li><p>Could this be coming from the database or server-level scripts?</p>
</li>
<li><p>Any recommended steps or tools to fully trace and remove this type of redirect malware?</p>
</li>
</ol>
<p>Any help or guidance would be really appreciated. Thanks!</p>
https://stackoverflow.com/q/3453423132Katie Fritzhttps://stackoverflow.com/users/57245052015-12-30T17:29:52Z2026-01-27T12:51:28Z
<p>I have a print stylesheet for my (Wordpress) site, and I want images to print on a single page rather than being split across pages. In some cases, even lines of text are being split across pages. I've included <code>img {page-break: avoid;)</code> in my print stylesheet, but no luck. I've found some previous answers but they're kind of old.</p>
<p>Is there a reliable way to print a moderately-sized image on a single page rather than splitting it across pages? Why are lines of text breaking across pages?</p>
<p><a href="https://i.sstatic.net/CJ6UZ.png" rel="noreferrer"><img src="https://i.sstatic.net/CJ6UZ.png" alt="picture broken across two pages"></a></p>
<p><img src="https://i.sstatic.net/6F8q7.png" alt="lines breaking across pages"></p>
<p>Site: <a href="http://74.220.217.211/housing-developments/grafton-townhomes/" rel="noreferrer">http://74.220.217.211/housing-developments/grafton-townhomes/</a></p>
<p>Related posts:</p>
<ul>
<li><p><strong><a href="https://stackoverflow.com/questions/2649169/print-styles-how-to-ensure-image-doesnt-span-a-page-break">Print styles: How to ensure image doesn't span a page break</a></strong></p></li>
<li><p><a href="https://stackoverflow.com/questions/2226939/what-are-most-useful-media-print-specfic-cross-browser-compatible-css-propert">What are most useful media="print" specfic ,cross browser compatible css properties?</a></p></li>
<li><p><a href="https://stackoverflow.com/questions/31331383/what-is-the-correct-way-to-do-the-css-to-avoid-page-breaks">What is the correct way to do the CSS to avoid page breaks?</a> </p></li>
<li><a href="https://stackoverflow.com/questions/7706504/page-break-inside-doesnt-work-in-chrome">page-break-inside doesn't work in Chrome?</a></li>
<li><a href="https://stackoverflow.com/questions/11432044/work-around-for-page-break-insideavoid">Work around for page-break-inside:avoid</a></li>
</ul>
https://stackoverflow.com/q/798756110Vinit Laddhahttps://stackoverflow.com/users/322586082026-01-25T09:32:08Z2026-01-27T08:10:32Z
<p>I have a question for wordpress and elementor users.</p>
<p>Which is better a container or sections?</p>
<p>My seniors are saying sections are better at responsiveness so we have to use sections, but I researched and found out that containers are better. My senior's explaination is like we are using sections for long time for all pages on our website so we have to use that only, but I think if containers are better then change can be done in new pages. What are your views on this.</p>
<p>Please help.</p>
https://stackoverflow.com/q/79876775-4user32266202https://stackoverflow.com/users/322662022026-01-27T00:54:03Z2026-01-27T02:57:10Z
<p>I'm just trying to host a website on localhost... sorry, I don't really know what I'm doing.</p>
<p>I've got this error when trying to go to: http://localhost/wordpress/</p>
<pre class="lang-none prettyprint-override"><code>**Fatal error**: Uncaught Error: Undefined constant "‘DB_NAME’" in C:\\xampp\\htdocs\\wp-config.php:23
Stack trace:
#0 C:\\xampp\\htdocs\\wordpress\\wp-load.php(55): require_once()
#1 C:\\xampp\\htdocs\\wordpress\\wp-blog-header.php(13): require_once('C:\\\\xampp\\\\htdocs...')
#2 C:\\xampp\\htdocs\\wordpress\\index.php(17): require('C:\\\\xampp\\\\htdocs...')
#3 {main} thrown in **C:\\xampp\\htdocs\\wp-config.php** on line **23**
// ** Database settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define(‘DB_NAME’, ‘wordpress’); **\<--- LINE 23**
</code></pre>
https://stackoverflow.com/q/4620992421Wes Asbellhttps://stackoverflow.com/users/74742772017-09-14T03:13:10Z2026-01-26T23:04:38Z
<p>I am trying to remove the "Have a coupon" section that sits at the top of a Woocommerce checkout page (/checkout).</p>
<p>I would like to keep the coupon section on the Cart page, so I can't completely disable coupons, but would like it removed on the checkout page.</p>
<p>Any help would be greatly appreciated.</p>
https://stackoverflow.com/q/183109700Praveen Mhttps://stackoverflow.com/users/26959252013-08-19T09:55:06Z2026-01-25T09:05:40Z
<p>This is a <em>PHP</em> code, in need to open a link in new tab.</p>
<p>But i tried <code>target='_blank'</code> in all the areas not working.</p>
<pre><code>return "<a href='".get_home_url()."/out/".$post->ID.
"/".$GLOBALS['CORE_THEME']['code_link']."/' title='"
.$post->ID."' rel='nofollow' class='btn btn-primary cbtn'>"
.$CORE->_e(array('button'))."</a>";
</code></pre>
<p>I think its calling the link from <code>code_link</code> not sure exactly.</p>
https://stackoverflow.com/q/798699592Shravani Kurkutehttps://stackoverflow.com/users/322161532026-01-17T06:40:39Z2026-01-23T12:26:05Z
<p>I am trying to understand how WordPress stores data internally in the database.</p>
<p>I know that WordPress uses MySQL and that default posts and pages are stored in the wp_posts table.</p>
<p>I would like to understand:</p>
<p>- When a custom post type is created, is it stored in the same wp_posts table?</p>
<p>- How does WordPress differentiate between posts, pages, and custom post types?</p>
<p>- Where are custom fields or metadata related to a custom post type stored?</p>
<p>- Are additional database tables involved, or does WordPress rely mainly on wp_posts and wp_postmeta?</p>
<p>I have read some documentation, but I am looking for a clear explanation of the database structure behind custom post types.</p>
<p>Any explanation or references to official documentation would be helpful.</p>
https://stackoverflow.com/q/212465024clawshttps://stackoverflow.com/users/1936532014-01-20T23:50:16Z2026-01-23T11:43:36Z
<p>I'm using a child theme. I want to override a template of base theme.
I created, <code>articles-page.php</code> which starts with:</p>
<pre><code><?php
/*
Template Name: Articles
*/
</code></pre>
<p>While creating a page in Wordpress I can see my template listed in the <em>Page Attributes</em> widget to my right. The problem is, when I change my template setting to "Articles" and hit update. It still shows <code>default</code>. My change is not being saved, hence my template is not being loaded for that page.</p>
https://stackoverflow.com/q/798737330Markhttps://stackoverflow.com/users/160384342026-01-22T12:27:31Z2026-01-23T11:36:53Z
<p>I have a product which i want the purchaser to build up a product by adding additional items, i have looked at using grouped or variable products but cant get the detail i require on the options, i have created a page with the options but when you click the buy button it takes you away from the main product, is there away to stop this with Css or code, using Oxygen 6 as builder, you can view page at <a href="https://ibc-container.co.uk/product/steel-ibc-tipper/" rel="nofollow noreferrer">https://ibc-container.co.uk/product/steel-ibc-tipper/</a></p>
https://stackoverflow.com/q/89288695Matthttps://stackoverflow.com/users/4732132012-01-19T15:40:05Z2026-01-22T20:03:40Z
<p>The below code displays my selected page, its content and shortcode correctly. The page is selected from a theme options panel in the WP Admin.</p>
<p>I am struggling to echo the post title. At the moment, it's echoing all page titles.</p>
<pre><code><?php
$blockwho = get_option('good_blockwho');
$homeblockwho = get_pages ('post_name='.$blockwho); ?>
<?php foreach ($homeblockwho as $hbw) {
$content = $hbw->post_content;
$title = $hbw->post_title;
apply_filters('the_content', $content);
echo "<h2><span>".$title."</span></h2>";
echo "".do_shortcode($content)."";
} ?>
</code></pre>
https://stackoverflow.com/q/427970500kitkatkarrothttps://stackoverflow.com/users/72906352017-03-14T21:40:34Z2026-01-22T19:36:29Z
<p>I would appreciate some help regarding Advanced Custom Fields repeater. The thing is that I am building a gallery with the plugin but I need pagination at the end of the page. I am displaying the pagination links, but when clicking they don't seem to work. Is it something with the url of the page - it's not showing page number in the url. Here is my code:</p>
<pre><code><?php
/*
* Paginate Advanced Custom Field repeater
*/
if (get_query_var('paged')) {
$page = get_query_var('paged');
} else {
$page = 1;
}
// Variables
$row = 0;
$images_per_page = 2; // How many images to display on each page
$images = get_field('thumbnail_image_repeater');
$total = count($images);
$pages = ceil($total / $images_per_page);
$min = (($page * $images_per_page) - $images_per_page) + 1;
$max = ($min + $images_per_page) - 1;
?>
<?php
if (have_rows('thumbnail_image_repeater')):
?>
<?php
while (have_rows('thumbnail_image_repeater')):
the_row();
$row++;
// Ignore this image if $row is lower than $min
if ($row < $min) {
continue;
}
// Stop loop completely if $row is higher than $max
if ($row > $max) {
break;
}
?>
<?php
$image = get_sub_field('thumbnail_image');
$thumbnail_name = get_sub_field('thumbnail_name');
?>
<li class="col-xs-6 col-sm-4 col-md-3" data-responsive="<?php
echo $image['url'];
?>" data-src="<?php
echo $image['url'];
?>" data-sub-html="<h4><?php
echo $thumbnail_name;
?></h4><p><?php
echo $thumbnail_name;
?></p>" data-pinterest-text="Pin it1" data-tweet-text="share on twitter 1">
<a href="">
<img class="img-responsive" src="<?php
echo $image['url'];
?>" alt="Thumb-1" />
</a>
</li>
<?php
endwhile;
// Pagination
echo paginate_links(array(
'base' => get_permalink() . '%#%' . '/',
'format' => '?page=%#%',
'current' => $page,
'total' => $pages,
'prev_text' => __('<<<'),
'next_text' => __('>>>')
));
?>
<?php
endif;
?>
</code></pre>
https://stackoverflow.com/q/79873790-4Sanad Qazihttps://stackoverflow.com/users/99453422026-01-22T13:37:35Z2026-01-22T13:50:58Z
<p>I’m implementing a custom <strong>author archive</strong> in WordPress where the author page lists posts based on custom meta fields (ACF user fields), not <code>post_author</code>.</p>
<h3>What works</h3>
<ul>
<li><p><code>/author/author-slug/</code> loads correctly</p>
</li>
<li><p>Page 1 shows the correct posts</p>
</li>
<li><p>Pagination links are generated correctly</p>
</li>
</ul>
<h3>What doesn’t work</h3>
<ul>
<li><p><code>/author/author-slug/page/2/</code> returns <strong>404 / Forbidden</strong></p>
</li>
<li><p>WordPress code and rewrites seem correct</p>
</li>
<li><p>Pagination never reaches WordPress on page 2 in staging</p>
</li>
</ul>
<hr />
<h3>Setup details</h3>
<ul>
<li><p>WordPress (Genesis-based theme, but not doing anything custom with Genesis loops)</p>
</li>
<li><p>Custom post type: <code>document</code></p>
</li>
<li><p>Author page shows documents where:</p>
<ul>
<li><p><code>_dg_document_writer_id = author_id</code> OR</p>
</li>
<li><p><code>_dg_document_reviewer_id = author_id</code></p>
</li>
</ul>
</li>
<li><p>Pagination size: 9</p>
</li>
</ul>
<h3>Code</h3>
<h4>Author template (<code>author.php</code>)</h4>
<pre><code><?php
/**
* Author archive template (DocumentGenius)
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// Full width (no sidebar).
add_filter( 'genesis_site_layout', '__genesis_return_full_width_content', 99 );
// Replace default loop.
remove_action( 'genesis_loop', 'genesis_do_loop' );
remove_action( 'genesis_before_loop', 'genesis_do_author_box_archive' );
remove_action( 'genesis_before_loop', 'genesis_do_author_title_description', 15 );
remove_action( 'genesis_before_loop', 'genesis_do_author_box_archive', 15 );
add_action( 'genesis_loop', 'dg_author_archive_loop' );
add_action( 'wp_enqueue_scripts', function () {
if ( is_author() ) {
wp_enqueue_style(
'dg-author',
get_stylesheet_directory_uri() . '/build/css/author.min.css',
array(),
filemtime( get_stylesheet_directory() . '/build/css/author.min.css' )
);
}
}, 20 );
function dg_author_archive_loop() {
// Load author page CSS (registered in dg_load_assets()).
wp_enqueue_style( 'dg-author' );
$user_id = (int) get_query_var( 'author' );
if ( ! $user_id ) {
$author = get_queried_object();
$user_id = ! empty( $author->ID ) ? (int) $author->ID : 0;
}
if ( ! $user_id ) {
echo '<p>Author not found.</p>';
return;
}
$user = get_user_by( 'id', $user_id );
// ACF user fields (saved against "user_{$id}").
$acf_ref = 'user_' . $user_id;
$image_id = (int) get_field( '_dg_user_image_id', $acf_ref );
$job_title = (string) get_field( '_dg_user_job_title', $acf_ref );
$employer = (string) get_field( '_dg_user_employer_name', $acf_ref );
$expertise = (string) get_field( '_dg_user_expertise', $acf_ref );
$education = (string) get_field( '_dg_user_education', $acf_ref ); // Optional (see section 4)
$location = (string) get_field( '_dg_user_location', $acf_ref ); // Optional (see section 4)
$bio_html = (string) get_field( '_dg_user_author_page_description', $acf_ref );
// Fallback to WP bio if ACF bio is empty.
if ( empty( trim( wp_strip_all_tags( $bio_html ) ) ) ) {
$bio_html = wpautop( get_the_author_meta( 'description', $user_id ) );
}
$display_name = ! empty( $user ) ? $user->display_name : ( ! empty( $author->display_name ) ? $author->display_name : 'Author' );
$subtitle_parts = array();
if ( $job_title ) {
$subtitle_parts[] = $job_title;
}
if ( $employer ) {
$subtitle_parts[] = $employer;
}
if ( $location ) {
$subtitle_parts[] = $location;
}
$subtitle = implode( ' · ', array_filter( $subtitle_parts ) );
// Parse textarea lists into arrays (one item per line).
$expertise_items = array_filter( preg_split( "/\r\n|\r|\n/", trim( $expertise ) ) );
$education_items = array_filter( preg_split( "/\r\n|\r|\n/", trim( $education ) ) );
// Pagination (WordPress uses "paged" for archives).
$paged = (int) get_query_var( 'paged' );
if ( $paged < 1 ) {
$paged = (int) get_query_var( 'page' ); // fallback
}
$paged = max( 1, $paged );
?>
<div class="top-section">
<div class="dg-author">
<header class="dg-author__hero">
<div class="dg-author__avatar">
<?php
if ( $image_id ) {
echo wp_get_attachment_image(
$image_id,
'thumbnail',
false,
array(
'alt' => esc_attr( $display_name ),
'loading' => 'eager',
)
);
} else {
// Fallback to WP avatar.
echo get_avatar( $user_id, 96, '', $display_name, array( 'loading' => 'eager' ) );
}
?>
</div>
<h1 class="dg-author__name"><?php echo esc_html( $display_name ); ?></h1>
<?php if ( $subtitle ) : ?>
<p class="dg-author__subtitle"><?php echo esc_html( $subtitle ); ?></p>
<?php endif; ?>
<?php if ( $bio_html ) : ?>
<div class="dg-author__bio">
<?php echo wp_kses_post( $bio_html ); ?>
</div>
<?php endif; ?>
<div class="dg-author__details">
<section class="dg-author__card">
<h2>Expertise</h2>
<?php if ( ! empty( $expertise_items ) ) : ?>
<ul>
<?php foreach ( $expertise_items as $item ) : ?>
<li><?php echo esc_html( trim( $item ) ); ?></li>
<?php endforeach; ?>
</ul>
<?php else : ?>
<p class="dg-author__muted">—</p>
<?php endif; ?>
</section>
<section class="dg-author__card">
<h2>Education</h2>
<?php if ( ! empty( $education_items ) ) : ?>
<ul>
<?php foreach ( $education_items as $item ) : ?>
<li><?php echo esc_html( trim( $item ) ); ?></li>
<?php endforeach; ?>
</ul>
<?php else : ?>
<p class="dg-author__muted">—</p>
<?php endif; ?>
</section>
</div>
</header>
<section class="dg-author__latest">
<h2><?php echo esc_html( 'Latest from ' . $display_name ); ?></h2>
<?php
// Pagination.
$paged = (int) get_query_var( 'paged' );
if ( $paged < 1 ) {
$paged = (int) get_query_var( 'page' ); // fallback
}
$paged = max( 1, $paged );
// Query documents by writer/reviewer meta.
$docs_q = new WP_Query(
array(
'post_type' => 'document',
'post_status' => 'publish',
'posts_per_page' => 9,
'paged' => $paged,
'orderby' => 'date',
'order' => 'DESC',
'meta_query' => array(
'relation' => 'OR',
// Writer (ID stored as int/string)
array(
'key' => '_dg_document_writer_id',
'value' => $user_id,
'compare' => '=',
),
// Writer (serialized storage)
array(
'key' => '_dg_document_writer_id',
'value' => '"' . $user_id . '"',
'compare' => 'LIKE',
),
// Reviewer (ID stored as int/string)
array(
'key' => '_dg_document_reviewer_id',
'value' => $user_id,
'compare' => '=',
),
// Reviewer (serialized storage)
array(
'key' => '_dg_document_reviewer_id',
'value' => '"' . $user_id . '"',
'compare' => 'LIKE',
),
),
)
);
if ( $docs_q->have_posts() ) : ?>
<div class="dg-author__grid">
<?php
while ( $docs_q->have_posts() ) :
$docs_q->the_post();
$post_id = get_the_ID();
$title = get_the_title();
$link = get_permalink();
$updated = get_post_meta( $post_id, '_dg_document_updated_date', true );
$date = $updated ? date_i18n( get_option( 'date_format' ), strtotime( $updated ) ) : get_the_date();
?>
<article class="dg-author__doc">
<a class="dg-author__docLink" href="<?php echo esc_url( $link ); ?>">
<div class="dg-author__thumb">
<?php if ( has_post_thumbnail() ) : ?>
<?php the_post_thumbnail( 'medium', array( 'loading' => 'lazy' ) ); ?>
<?php else : ?>
<span class="dg-author__thumbPlaceholder" aria-hidden="true"></span>
<?php endif; ?>
</div>
<h3 class="dg-author__docTitle"><?php echo esc_html( $title ); ?></h3>
<p class="dg-author__docMeta"><?php echo esc_html( $date ); ?></p>
</a>
</article>
<?php
endwhile;
?>
</div>
<?php
// Pagination links (pretty permalinks compatible).
$links = paginate_links(
array(
'total' => max( 1, (int) $docs_q->max_num_pages ),
'current' => $paged,
'type' => 'list',
'prev_text' => 'Previous',
'next_text' => 'Next',
)
);
if ( $links ) : ?>
<nav class="dg-author__pagination" aria-label="Pagination">
<?php echo wp_kses_post( $links ); ?>
</nav>
<?php endif; ?>
<?php else : ?>
<p class="dg-author__muted">No documents found for this author yet.</p>
<?php
endif;
wp_reset_postdata();
?>
</section>
</div>
</div>
<?php
}
genesis();
</code></pre>
<hr />
<h4>Rewrite rule</h4>
<pre><code>add_action( 'init', function () {
add_rewrite_rule(
'^author/([^/]+)/page/([0-9]+)/?$',
'index.php?author_name=$matches[1]&paged=$matches[2]',
'top'
);
});
</code></pre>
<p>Permalinks flushed.</p>
<hr />
<h3>Debugging observations</h3>
<ul>
<li><p>Page 1 works</p>
</li>
<li><p>Page 2 never reaches WordPress</p>
</li>
<li><p><code>curl -I /author/slug/page/2/</code> returns <strong>403 Forbidden</strong></p>
</li>
<li><p>Response headers indicate the request is blocked <strong>before WordPress runs</strong></p>
</li>
</ul>
<hr />
<h3>Can someone help to fix?</h3>
https://stackoverflow.com/q/316649872MrCarrothttps://stackoverflow.com/users/18499812015-07-27T23:23:39Z2026-01-21T09:18:39Z
<p>I'm using the Woocommerce Subscriptions plugin, and in the processing order renewal email I wanted to show when the next payment date will be. However when I try to access the next payment date for an order it always returns false.</p>
<pre><code><?php
if (WC_Subscriptions_Renewal_Order::is_renewal( $order ) ) { /* This returns true */
$parent_id = WC_Subscriptions_Renewal_Order::get_parent_order_id( $order ); /* This gets the original parent order id */
$parent_order = new WC_Order( $parent_id );
foreach ($parent_order->get_items() as $item) { /* This loops through each item in the order */
$h = WC_Subscriptions_Order::get_next_payment_date ( $parent_order, $item['product_id'] ); /* This should get the next payment date... */
var_dump($h); /* But it returns false :-( */
}
}
?>
</code></pre>
<p>Other functions such as <code>WC_Subscriptions_Order::get_total_initial_payment()</code> work as expected.</p>
<p>How can I get the next payment date for a subscription order?</p>