<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>wordpress Archives - CNERIS</title>
	<atom:link href="https://cneris.com/en/tag/wordpress-en/feed/" rel="self" type="application/rss+xml" />
	<link>https://cneris.com/en/tag/wordpress-en/</link>
	<description></description>
	<lastBuildDate>Tue, 29 Oct 2024 09:09:24 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.1</generator>
	<item>
		<title>A PHP session was created by a session_start() function call. This interferes with REST API and loopback requests. The session should be closed by session_write_close() before making any HTTP requests.</title>
		<link>https://cneris.com/en/a-php-session-was-created-by-a-session_start-function-call-this-interferes-with-rest-api-and-loopback-requests-the-session-should-be-closed-by-session_write_close-before-making-any-http-requests-2/</link>
					<comments>https://cneris.com/en/a-php-session-was-created-by-a-session_start-function-call-this-interferes-with-rest-api-and-loopback-requests-the-session-should-be-closed-by-session_write_close-before-making-any-http-requests-2/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Tue, 29 Oct 2024 09:09:24 +0000</pubDate>
				<category><![CDATA[Centos]]></category>
		<category><![CDATA[Dedicated servers]]></category>
		<category><![CDATA[Plesk]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[session_close]]></category>
		<category><![CDATA[session_start]]></category>
		<category><![CDATA[wordpress]]></category>
		<guid isPermaLink="false">https://cneris.com/?p=2680</guid>

					<description><![CDATA[<p>This error occurs because the session_start() function is creating a PHP session, which interferes with REST API and loopback requests in WordPress. To resolve this: Locate the session_start() code Search your theme or active plugins for the session_start() function. It may be in the theme’s functions.php file or in a custom plugin. Add session_write_close() after [...]</p>
<p>The post <a href="https://cneris.com/en/a-php-session-was-created-by-a-session_start-function-call-this-interferes-with-rest-api-and-loopback-requests-the-session-should-be-closed-by-session_write_close-before-making-any-http-requests-2/">A PHP session was created by a session_start() function call. This interferes with REST API and loopback requests. The session should be closed by session_write_close() before making any HTTP requests.</a> appeared first on <a href="https://cneris.com/en">CNERIS</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>This error occurs because the <code>session_start()</code> function is creating a PHP session, which interferes with REST API and loopback requests in WordPress. To resolve this:</p>
<ol>
<li><strong>Locate the <code>session_start()</code> code</strong><br />
Search your theme or active plugins for the <code>session_start()</code> function. It may be in the theme’s <code>functions.php</code> file or in a custom plugin.</li>
<li><strong>Add <code>session_write_close()</code> after <code>session_start()</code></strong><br />
Ensure <code>session_write_close()</code> is called after each <code>session_start()</code> call, before making any HTTP requests. This will close the session and allow the REST API to work correctly. For example:</p>
<div class="contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950">
<div class="sticky top-9 md:top-[5.75rem]"></div>
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-php"><span class="hljs-title function_ invoke__">session_start</span>();<br />
<span class="hljs-comment">// Your code here</span><br />
<span class="hljs-title function_ invoke__">session_write_close</span>();<br />
</code></div>
</div>
</li>
<li><strong>Use the <code>init</code> hook in WordPress</strong><br />
If <code>session_start()</code> needs to be in <code>functions.php</code>, make sure to wrap it in the <code>init</code> hook and use <code>session_write_close()</code> like this:</p>
<div class="contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950">
<div class="sticky top-9 md:top-[5.75rem]"></div>
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-php"><span class="hljs-title function_ invoke__">add_action</span>(<span class="hljs-string">'init'</span>, function() {<br />
    <span class="hljs-keyword">if</span> (!<span class="hljs-title function_ invoke__">session_id</span>()) {<br />
        <span class="hljs-title function_ invoke__">session_start</span>();<br />
        <span class="hljs-title function_ invoke__">session_write_close</span>();<br />
    }<br />
});</code></div>
</div>
</li>
</ol>
<p>The post <a href="https://cneris.com/en/a-php-session-was-created-by-a-session_start-function-call-this-interferes-with-rest-api-and-loopback-requests-the-session-should-be-closed-by-session_write_close-before-making-any-http-requests-2/">A PHP session was created by a session_start() function call. This interferes with REST API and loopback requests. The session should be closed by session_write_close() before making any HTTP requests.</a> appeared first on <a href="https://cneris.com/en">CNERIS</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://cneris.com/en/a-php-session-was-created-by-a-session_start-function-call-this-interferes-with-rest-api-and-loopback-requests-the-session-should-be-closed-by-session_write_close-before-making-any-http-requests-2/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How you can set a default featured image for each post category</title>
		<link>https://cneris.com/en/how-you-can-set-a-default-featured-image-for-each-post-category/</link>
					<comments>https://cneris.com/en/how-you-can-set-a-default-featured-image-for-each-post-category/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Tue, 29 Oct 2024 08:59:48 +0000</pubDate>
				<category><![CDATA[Centos]]></category>
		<category><![CDATA[Dedicated servers]]></category>
		<category><![CDATA[Plesk]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Web Applications]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[featured image]]></category>
		<category><![CDATA[post category]]></category>
		<category><![CDATA[wordpress]]></category>
		<guid isPermaLink="false">https://cneris.com/?p=2671</guid>

					<description><![CDATA[<p>In WordPress, you can set a default featured image for each post category by using a snippet of code in your theme's functions.php file. This code checks if a post has a featured image assigned; if not, it sets a default image based on the post's category. Code to Assign Default Featured Image by Category [...]</p>
<p>The post <a href="https://cneris.com/en/how-you-can-set-a-default-featured-image-for-each-post-category/">How you can set a default featured image for each post category</a> appeared first on <a href="https://cneris.com/en">CNERIS</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>In WordPress, you can set a default featured image for each post category by using a snippet of code in your theme&#8217;s <code>functions.php</code> file. This code checks if a post has a featured image assigned; if not, it sets a default image based on the post&#8217;s category.</p>
<h4>Code to Assign Default Featured Image by Category</h4>
<ol>
<li>Open your theme&#8217;s <code>functions.php</code> file (preferably a child theme to avoid losing changes with updates).</li>
<li>Add the following code, replacing the URLs with your default images for each category:</li>
</ol>
<div class="contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950">
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-php"><br />
</code></div>
</div>
<p>function set_default_thumbnail($post_id) {<br />
if (has_post_thumbnail($post_id)) {<br />
return;<br />
}</p>
<p>// Define default images for each category<br />
$default_images = [<br />
&#8216;category-1&#8217; =&gt; &#8216;https://your-site.com/wp-content/uploads/category-image1.jpg&#8217;,<br />
&#8216;category-2&#8217; =&gt; &#8216;https://your-site.com/wp-content/uploads/category-image2.jpg&#8217;,<br />
&#8216;category-3&#8217; =&gt; &#8216;https://your-site.com/wp-content/uploads/category-image3.jpg&#8217;,<br />
];</p>
<p>// Get post categories<br />
$categories = get_the_category($post_id);</p>
<p>// Check if categories are assigned and find a matching default image<br />
foreach ($categories as $category) {<br />
if (array_key_exists($category-&gt;slug, $default_images)) {<br />
$image_url = $default_images[$category-&gt;slug];</p>
<p>// Download image and set as featured image<br />
$image_id = attach_image_from_url($image_url, $post_id);<br />
if ($image_id) {<br />
set_post_thumbnail($post_id, $image_id);<br />
}<br />
break;<br />
}<br />
}<br />
}<br />
add_action(&#8216;save_post&#8217;, &#8216;set_default_thumbnail&#8217;);</p>
<p>// Function to download and attach the image to the post<br />
function attach_image_from_url($image_url, $post_id) {<br />
$upload_dir = wp_upload_dir();<br />
$image_data = file_get_contents($image_url);<br />
$filename = basename($image_url);</p>
<p>if (wp_mkdir_p($upload_dir[&#8216;path&#8217;])) {<br />
$file = $upload_dir[&#8216;path&#8217;] . &#8216;/&#8217; . $filename;<br />
} else {<br />
$file = $upload_dir[&#8216;basedir&#8217;] . &#8216;/&#8217; . $filename;<br />
}</p>
<p>file_put_contents($file, $image_data);</p>
<p>$wp_filetype = wp_check_filetype($filename, null);<br />
$attachment = [<br />
&#8216;post_mime_type&#8217; =&gt; $wp_filetype[&#8216;type&#8217;],<br />
&#8216;post_title&#8217; =&gt; sanitize_file_name($filename),<br />
&#8216;post_content&#8217; =&gt; &#8221;,<br />
&#8216;post_status&#8217; =&gt; &#8216;inherit&#8217;<br />
];</p>
<p>$attach_id = wp_insert_attachment($attachment, $file, $post_id);<br />
require_once(ABSPATH . &#8216;wp-admin/includes/image.php&#8217;);<br />
$attach_data = wp_generate_attachment_metadata($attach_id, $file);<br />
wp_update_attachment_metadata($attach_id, $attach_data);</p>
<p>return $attach_id;<br />
}</p>
<h4>Code Explanation</h4>
<ul>
<li><strong><code>$default_images</code></strong>: Defines default images for each category using the category slug as the key and the image URL as the value.</li>
<li><strong><code>set_default_thumbnail</code></strong>: This function runs when a post is saved. If the post has no featured image, it finds the first category with a default image in <code>$default_images</code> and sets it as the featured image.</li>
<li><strong><code>attach_image_from_url</code></strong>: This function downloads the image from the URL and attaches it to the post as a media file, making it the featured image.</li>
</ul>
<p>This code will automatically assign a default featured image for new or edited posts based on their category.</p>
<p><strong>Note</strong>: Make sure to test this code in a development environment before implementing it on your live site, and replace the example URLs with your actual default image URLs.</p>
<p>The post <a href="https://cneris.com/en/how-you-can-set-a-default-featured-image-for-each-post-category/">How you can set a default featured image for each post category</a> appeared first on <a href="https://cneris.com/en">CNERIS</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://cneris.com/en/how-you-can-set-a-default-featured-image-for-each-post-category/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to automatically generate a PDF with Forminator form responses in WordPress</title>
		<link>https://cneris.com/en/how-to-automatically-generate-a-pdf-with-forminator-form-responses-in-wordpress/</link>
					<comments>https://cneris.com/en/how-to-automatically-generate-a-pdf-with-forminator-form-responses-in-wordpress/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 26 Oct 2024 10:25:27 +0000</pubDate>
				<category><![CDATA[Web Applications]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[create the form]]></category>
		<category><![CDATA[installa forminator]]></category>
		<category><![CDATA[pdf plugin]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[zapier]]></category>
		<guid isPermaLink="false">https://cneris.com/?p=2553</guid>

					<description><![CDATA[<p>To automatically generate a PDF with Forminator form responses in WordPress, follow these detailed steps: Install Forminator and Create the Form: Ensure your form is configured in Forminator with all the fields you need in the PDF. Use a PDF Plugin or Zapier to Create the PDF: Forminator doesn’t natively support PDF generation, but you [...]</p>
<p>The post <a href="https://cneris.com/en/how-to-automatically-generate-a-pdf-with-forminator-form-responses-in-wordpress/">How to automatically generate a PDF with Forminator form responses in WordPress</a> appeared first on <a href="https://cneris.com/en">CNERIS</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>To automatically generate a PDF with Forminator form responses in WordPress, follow these detailed steps:</p>
<ol>
<li><strong>Install Forminator and Create the Form</strong>:
<ul>
<li>Ensure your form is configured in Forminator with all the fields you need in the PDF.</li>
</ul>
</li>
<li><strong>Use a PDF Plugin or Zapier to Create the PDF</strong>: Forminator doesn’t natively support PDF generation, but you can use a plugin or external tool.
<ul>
<li><strong>WP PDF Plugin</strong>: A premium plugin that can automatically generate PDFs from form responses in WordPress.</li>
<li><strong>Zapier</strong>: Connect Forminator to Zapier to send data to Google Docs or a PDF generator app like PDF Generator API.</li>
</ul>
</li>
<li><strong>Automate the PDF Creation</strong>: Set up an automation so that whenever a user submits a Forminator form, responses are automatically sent to the PDF creation tool, which generates and emails the final file.</li>
</ol>
<p>The post <a href="https://cneris.com/en/how-to-automatically-generate-a-pdf-with-forminator-form-responses-in-wordpress/">How to automatically generate a PDF with Forminator form responses in WordPress</a> appeared first on <a href="https://cneris.com/en">CNERIS</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://cneris.com/en/how-to-automatically-generate-a-pdf-with-forminator-form-responses-in-wordpress/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to change the database character set in WordPress</title>
		<link>https://cneris.com/en/how-to-change-the-database-character-set-in-wordpress/</link>
					<comments>https://cneris.com/en/how-to-change-the-database-character-set-in-wordpress/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sun, 20 Oct 2024 16:52:26 +0000</pubDate>
				<category><![CDATA[System Administration]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[charaters]]></category>
		<category><![CDATA[codification]]></category>
		<category><![CDATA[utf-8]]></category>
		<category><![CDATA[utf8mb4]]></category>
		<category><![CDATA[wordpress]]></category>
		<guid isPermaLink="false">https://cneris.com/?p=2519</guid>

					<description><![CDATA[<p>To change the database character set in WordPress, follow these steps: Access the wp-config.php file located in the root directory of your WordPress installation. Look for the following lines: php Copiar código define('DB_CHARSET', 'utf8mb4'); define('DB_COLLATE', ''); If these lines are missing or set to a different value, change DB_CHARSET to utf8mb4, which is the recommended [...]</p>
<p>The post <a href="https://cneris.com/en/how-to-change-the-database-character-set-in-wordpress/">How to change the database character set in WordPress</a> appeared first on <a href="https://cneris.com/en">CNERIS</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>To change the database character set in WordPress, follow these steps:</p>
<ol>
<li><strong>Access the <code>wp-config.php</code> file</strong> located in the root directory of your WordPress installation.</li>
<li>Look for the following lines:
<div class="contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950">
<div class="flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary">php</div>
<div class="sticky top-9 md:top-[5.75rem]">
<div class="absolute bottom-0 right-2 flex h-9 items-center">
<div class="flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary"><span class="" data-state="closed"><button class="flex gap-1 items-center py-1">Copiar código</button></span></div>
</div>
</div>
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-php"><span class="hljs-title function_ invoke__">define</span>(<span class="hljs-string">'DB_CHARSET'</span>, <span class="hljs-string">'utf8mb4'</span>);<br />
<span class="hljs-title function_ invoke__">define</span>(<span class="hljs-string">'DB_COLLATE'</span>, <span class="hljs-string">''</span>);<br />
</code></div>
</div>
</li>
<li>If these lines are missing or set to a different value, change <strong><code>DB_CHARSET</code></strong> to <strong><code>utf8mb4</code></strong>, which is the recommended character set for supporting special characters, including Chinese. <strong><code>DB_COLLATE</code></strong> should be left empty or set to <strong><code>utf8mb4_unicode_ci</code></strong> if you want to specify a collation.</li>
<li>Save the changes and upload the file back to the server if you are working locally.</li>
</ol>
<p>With this change, WordPress will be configured to use the UTF-8 character set, ensuring that special characters, such as Chinese, display correctly.</p>
<p>The post <a href="https://cneris.com/en/how-to-change-the-database-character-set-in-wordpress/">How to change the database character set in WordPress</a> appeared first on <a href="https://cneris.com/en">CNERIS</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://cneris.com/en/how-to-change-the-database-character-set-in-wordpress/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to increase the memory limit in WordPress (wp_max_memory_limit)?</title>
		<link>https://cneris.com/en/how-to-increase-the-memory-limit-in-wordpress-wp_max_memory_limit/</link>
					<comments>https://cneris.com/en/how-to-increase-the-memory-limit-in-wordpress-wp_max_memory_limit/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sun, 20 Oct 2024 16:30:39 +0000</pubDate>
				<category><![CDATA[Centos]]></category>
		<category><![CDATA[Dedicated servers]]></category>
		<category><![CDATA[Plesk]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[php.ini]]></category>
		<category><![CDATA[restart the server]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wp-config]]></category>
		<category><![CDATA[wp_memory_limit]]></category>
		<guid isPermaLink="false">https://cneris.com/?p=2496</guid>

					<description><![CDATA[<p>To increase the memory limit in WordPress (wp_max_memory_limit), you need to edit the wp-config.php file or your server's configuration file. Here are the steps: Edit the wp-config.php file: Access the wp-config.php file in your WordPress installation. Add the following line of code before the line that says "/* That's all, stop editing! */": define('WP_MEMORY_LIMIT', '256M'); [...]</p>
<p>The post <a href="https://cneris.com/en/how-to-increase-the-memory-limit-in-wordpress-wp_max_memory_limit/">How to increase the memory limit in WordPress (wp_max_memory_limit)?</a> appeared first on <a href="https://cneris.com/en">CNERIS</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>To increase the memory limit in WordPress (<strong>wp_max_memory_limit</strong>), you need to edit the <strong>wp-config.php</strong> file or your server&#8217;s configuration file. Here are the steps:</p>
<ol>
<li><strong>Edit the wp-config.php file</strong>:
<ul>
<li>Access the <strong>wp-config.php</strong> file in your WordPress installation.</li>
<li>Add the following line of code before the line that says &#8220;/* That&#8217;s all, stop editing! */&#8221;:
<div class="contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950">
<div class="sticky top-9 md:top-[5.75rem]"></div>
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-php"><span class="hljs-title function_ invoke__">define</span>(<span class="hljs-string">'WP_MEMORY_LIMIT'</span>, <span class="hljs-string">'256M'</span>);<br />
</code></div>
</div>
</li>
</ul>
<p>This sets the memory limit to 256 MB. You can adjust the value depending on your needs, such as <strong>128M</strong> or <strong>512M</strong>.</li>
<li><strong>Edit php.ini</strong> (optional):
<ul>
<li>If you have access to the <strong>php.ini</strong> file on your server, find the line:
<div class="contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950">
<div class="sticky top-9 md:top-[5.75rem]"></div>
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-ini"><span class="hljs-attr">memory_limit</span> = <span class="hljs-number">128</span>M<br />
</code></div>
</div>
</li>
<li>Change the value to a higher one, like <strong>256M</strong> or more, according to your requirements.</li>
</ul>
</li>
<li><strong>Restart the server</strong>:
<ul>
<li>After making the changes, if you modified the <strong>php.ini</strong> file, you need to restart the server for the changes to take effect.</li>
</ul>
</li>
</ol>
<p>The post <a href="https://cneris.com/en/how-to-increase-the-memory-limit-in-wordpress-wp_max_memory_limit/">How to increase the memory limit in WordPress (wp_max_memory_limit)?</a> appeared first on <a href="https://cneris.com/en">CNERIS</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://cneris.com/en/how-to-increase-the-memory-limit-in-wordpress-wp_max_memory_limit/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to Fix the Issue of WordPress Not Sending Emails:</title>
		<link>https://cneris.com/en/how-to-fix-the-issue-of-wordpress-not-sending-emails/</link>
					<comments>https://cneris.com/en/how-to-fix-the-issue-of-wordpress-not-sending-emails/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Mon, 01 Jul 2024 19:34:11 +0000</pubDate>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[wordpress]]></category>
		<guid isPermaLink="false">https://cneris.com/?p=1594</guid>

					<description><![CDATA[<p>Check Email Configuration: Ensure that the email address in WordPress is correctly configured. Use an SMTP Plugin: Install a plugin like WP Mail SMTP. Configure it with the details of your email provider (Gmail, SendGrid, etc.). Verify Mail Server: Make sure that your hosting server allows the sending of emails. Check Spam Folder: Sometimes, emails [...]</p>
<p>The post <a href="https://cneris.com/en/how-to-fix-the-issue-of-wordpress-not-sending-emails/">How to Fix the Issue of WordPress Not Sending Emails:</a> appeared first on <a href="https://cneris.com/en">CNERIS</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>Check Email Configuration:</strong></p>
<ul>
<li>Ensure that the email address in WordPress is correctly configured.</li>
</ul>
<p><strong>Use an SMTP Plugin:</strong></p>
<ul>
<li>Install a plugin like WP Mail SMTP.</li>
<li>Configure it with the details of your email provider (Gmail, SendGrid, etc.).</li>
</ul>
<p><strong>Verify Mail Server:</strong></p>
<ul>
<li>Make sure that your hosting server allows the sending of emails.</li>
</ul>
<p><strong>Check Spam Folder:</strong></p>
<ul>
<li>Sometimes, emails may end up in the spam folder.</li>
</ul>
<p><strong>Temporarily Disable Security Plugins:</strong></p>
<ul>
<li>Some security plugins may block email sending.</li>
</ul>
<p><strong>Consult Your Hosting Provider:</strong></p>
<ul>
<li>Ask your provider for assistance, as there may be server restrictions.</li>
</ul>
<p>By following these steps, you should be able to resolve the issue.</p>
<p>The post <a href="https://cneris.com/en/how-to-fix-the-issue-of-wordpress-not-sending-emails/">How to Fix the Issue of WordPress Not Sending Emails:</a> appeared first on <a href="https://cneris.com/en">CNERIS</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://cneris.com/en/how-to-fix-the-issue-of-wordpress-not-sending-emails/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Avoid repeating posts in WordPress</title>
		<link>https://cneris.com/en/avoid-repeating-posts-in-wordpress/</link>
					<comments>https://cneris.com/en/avoid-repeating-posts-in-wordpress/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Mon, 01 Jul 2024 16:56:43 +0000</pubDate>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[avoid repeating posts]]></category>
		<category><![CDATA[wordpress]]></category>
		<guid isPermaLink="false">https://cneris.com/?p=1561</guid>

					<description><![CDATA[<p>To avoid showing the same WordPress post in multiple loops, you can use a couple of methods. The most common approach is to keep track of the post IDs that have already been displayed and then exclude those posts from subsequent loops. Here’s a step-by-step guide on how to achieve this: Method 1: Using Global [...]</p>
<p>The post <a href="https://cneris.com/en/avoid-repeating-posts-in-wordpress/">Avoid repeating posts in WordPress</a> appeared first on <a href="https://cneris.com/en">CNERIS</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>To avoid showing the same WordPress post in multiple loops, you can use a couple of methods. The most common approach is to keep track of the post IDs that have already been displayed and then exclude those posts from subsequent loops. Here’s a step-by-step guide on how to achieve this:</p>
<h3>Method 1: Using Global Variable</h3>
<ol>
<li><strong>Initialize an Array to Store Displayed Post IDs</strong>Before your first loop, initialize an empty array to keep track of the post IDs.
<div class="dark bg-gray-950 rounded-md border-[0.5px] border-token-border-medium">
<div class="flex items-center relative text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md">
<p>php</p>
<div class="flex items-center"></div>
</div>
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-php"><span class="hljs-keyword">global</span> <span class="hljs-variable">$do_not_duplicate</span>;<br />
<span class="hljs-variable">$do_not_duplicate</span> = <span class="hljs-keyword">array</span>();<br />
</code></div>
</div>
</li>
<li><strong>First Loop</strong>In your first loop, store the post IDs of the displayed posts in the global array.
<div class="dark bg-gray-950 rounded-md border-[0.5px] border-token-border-medium">
<div class="flex items-center relative text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md">
<p>php</p>
<div class="flex items-center"></div>
</div>
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-php"><code class="!whitespace-pre hljs language-php"><span class="hljs-meta">&lt;?php</span><br />
<span class="hljs-keyword">global</span> <span class="hljs-variable">$do_not_duplicate</span>;<br />
<span class="hljs-variable">$query1</span> = <span class="hljs-keyword">new</span> <span class="hljs-title class_">WP_Query</span>(<span class="hljs-keyword">array</span>(<br />
<span class="hljs-string">'posts_per_page'</span> =&gt; 5,<br />
));</code></code><span class="hljs-keyword">if</span> (<span class="hljs-variable">$query1</span>-&gt;<span class="hljs-title function_ invoke__">have_posts</span>()) :<br />
<span class="hljs-keyword">while</span> (<span class="hljs-variable">$query1</span>-&gt;<span class="hljs-title function_ invoke__">have_posts</span>()) : <span class="hljs-variable">$query1</span>-&gt;<span class="hljs-title function_ invoke__">the_post</span>();<br />
<span class="hljs-variable">$do_not_duplicate</span>[] = <span class="hljs-title function_ invoke__">get_the_ID</span>();<br />
<span class="hljs-comment">// Your loop code here</span><br />
<span class="hljs-keyword">endwhile</span>;<br />
<span class="hljs-title function_ invoke__">wp_reset_postdata</span>();<br />
<span class="hljs-keyword">endif</span>;<br />
<span class="hljs-meta">?&gt;</span></p>
</div>
</div>
</li>
<li><strong>Second Loop</strong>In your second loop, exclude the post IDs stored in the global array.
<div class="dark bg-gray-950 rounded-md border-[0.5px] border-token-border-medium">
<div class="flex items-center relative text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md">
<p>php</p>
<div class="flex items-center"></div>
</div>
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-php"><code class="!whitespace-pre hljs language-php"><span class="hljs-meta">&lt;?php</span><br />
<span class="hljs-keyword">global</span> <span class="hljs-variable">$do_not_duplicate</span>;<br />
<span class="hljs-variable">$query2</span> = <span class="hljs-keyword">new</span> <span class="hljs-title class_">WP_Query</span>(<span class="hljs-keyword">array</span>(<br />
<span class="hljs-string">'posts_per_page'</span> =&gt; 5,<br />
<span class="hljs-string">'post__not_in'</span> =&gt; <span class="hljs-variable">$do_not_duplicate</span>,<br />
));</code></code><span class="hljs-keyword">if</span> (<span class="hljs-variable">$query2</span>-&gt;<span class="hljs-title function_ invoke__">have_posts</span>()) :<br />
<span class="hljs-keyword">while</span> (<span class="hljs-variable">$query2</span>-&gt;<span class="hljs-title function_ invoke__">have_posts</span>()) : <span class="hljs-variable">$query2</span>-&gt;<span class="hljs-title function_ invoke__">the_post</span>();<br />
<span class="hljs-comment">// Your loop code here</span><br />
<span class="hljs-keyword">endwhile</span>;<br />
<span class="hljs-title function_ invoke__">wp_reset_postdata</span>();<br />
<span class="hljs-keyword">endif</span>;<br />
<span class="hljs-meta">?&gt;</span></p>
</div>
</div>
</li>
</ol>
<h3>Method 2: Using Transients for More Complex Scenarios</h3>
<p>If you have more complex scenarios or need to persist the exclusion across different parts of your site, you might consider using WordPress transients.</p>
<ol>
<li><strong>Set Up a Transient</strong>Before your loops, check if a transient exists and use it. If not, initialize an empty array.
<div class="dark bg-gray-950 rounded-md border-[0.5px] border-token-border-medium">
<div class="flex items-center relative text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md">
<p>php</p>
<div class="flex items-center"></div>
</div>
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-php"><span class="hljs-variable">$do_not_duplicate</span> = <span class="hljs-title function_ invoke__">get_transient</span>(<span class="hljs-string">'excluded_posts'</span>) ? <span class="hljs-title function_ invoke__">get_transient</span>(<span class="hljs-string">'excluded_posts'</span>) : <span class="hljs-keyword">array</span>();<br />
</code></div>
</div>
</li>
<li><strong>First Loop</strong>Store the post IDs in the transient after your first loop.
<div class="dark bg-gray-950 rounded-md border-[0.5px] border-token-border-medium">
<div class="flex items-center relative text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md">
<p>php</p>
<div class="flex items-center"></div>
</div>
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-php"><code class="!whitespace-pre hljs language-php"><span class="hljs-meta">&lt;?php</span><br />
<span class="hljs-variable">$query1</span> = <span class="hljs-keyword">new</span> <span class="hljs-title class_">WP_Query</span>(<span class="hljs-keyword">array</span>(<br />
<span class="hljs-string">'posts_per_page'</span> =&gt; 5,<br />
));</code></code><span class="hljs-keyword">if</span> (<span class="hljs-variable">$query1</span>-&gt;<span class="hljs-title function_ invoke__">have_posts</span>()) :<br />
<span class="hljs-keyword">while</span> (<span class="hljs-variable">$query1</span>-&gt;<span class="hljs-title function_ invoke__">have_posts</span>()) : <span class="hljs-variable">$query1</span>-&gt;<span class="hljs-title function_ invoke__">the_post</span>();<br />
<span class="hljs-variable">$do_not_duplicate</span>[] = <span class="hljs-title function_ invoke__">get_the_ID</span>();<br />
<span class="hljs-comment">// Your loop code here</span><br />
<span class="hljs-keyword">endwhile</span>;<br />
<span class="hljs-title function_ invoke__">wp_reset_postdata</span>();<br />
<span class="hljs-title function_ invoke__">set_transient</span>(<span class="hljs-string">&#8216;excluded_posts&#8217;</span>, <span class="hljs-variable">$do_not_duplicate</span>, HOUR_IN_SECONDS);<br />
<span class="hljs-keyword">endif</span>;<br />
<span class="hljs-meta">?&gt;</span></p>
</div>
</div>
</li>
<li><strong>Second Loop</strong>Exclude the post IDs stored in the transient in your second loop.
<div class="dark bg-gray-950 rounded-md border-[0.5px] border-token-border-medium">
<div class="flex items-center relative text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md">
<p>php</p>
<div class="flex items-center"></div>
</div>
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-php"><code class="!whitespace-pre hljs language-php"><span class="hljs-meta">&lt;?php</span><br />
<span class="hljs-variable">$query2</span> = <span class="hljs-keyword">new</span> <span class="hljs-title class_">WP_Query</span>(<span class="hljs-keyword">array</span>(<br />
<span class="hljs-string">'posts_per_page'</span> =&gt; 5,<br />
<span class="hljs-string">'post__not_in'</span> =&gt; <span class="hljs-variable">$do_not_duplicate</span>,<br />
));</code></code><span class="hljs-keyword">if</span> (<span class="hljs-variable">$query2</span>-&gt;<span class="hljs-title function_ invoke__">have_posts</span>()) :<br />
<span class="hljs-keyword">while</span> (<span class="hljs-variable">$query2</span>-&gt;<span class="hljs-title function_ invoke__">have_posts</span>()) : <span class="hljs-variable">$query2</span>-&gt;<span class="hljs-title function_ invoke__">the_post</span>();<br />
<span class="hljs-comment">// Your loop code here</span><br />
<span class="hljs-keyword">endwhile</span>;<br />
<span class="hljs-title function_ invoke__">wp_reset_postdata</span>();<br />
<span class="hljs-keyword">endif</span>;<br />
<span class="hljs-meta">?&gt;</span></p>
</div>
</div>
</li>
</ol>
<p>By following these methods, you can avoid displaying the same post in multiple loops on your WordPress site. The first method using a global variable is straightforward and works well for simple use cases. The second method using transients is more suitable for complex scenarios where exclusions need to persist across different parts of the site or for a longer duration.</p>
<p>The post <a href="https://cneris.com/en/avoid-repeating-posts-in-wordpress/">Avoid repeating posts in WordPress</a> appeared first on <a href="https://cneris.com/en">CNERIS</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://cneris.com/en/avoid-repeating-posts-in-wordpress/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
