<?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>WPWife &#187; Custom Fields</title>
	<atom:link href="http://www.wpwife.com/category/custom-fields/feed" rel="self" type="application/rss+xml" />
	<link>http://www.wpwife.com</link>
	<description>WPHelp: fix and optimise WP themes&#38;plugins</description>
	<lastBuildDate>Fri, 21 Nov 2025 12:00:00 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.1.38</generator>
	<item>
		<title>WordPress Custom Fields 101: Tips, Tricks, and Hacks</title>
		<link>http://www.wpwife.com/tutorials/wordpress-custom-fields-101-tips-tricks-and-hacks</link>
		<comments>http://www.wpwife.com/tutorials/wordpress-custom-fields-101-tips-tricks-and-hacks#comments</comments>
		<pubDate>Fri, 21 Jul 2023 15:01:51 +0000</pubDate>
		<dc:creator><![CDATA[Editorial Staff]]></dc:creator>
				<category><![CDATA[acf]]></category>
		<category><![CDATA[Advanced Custom Fields]]></category>
		<category><![CDATA[Custom Fields]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[wpcode]]></category>

		<guid isPermaLink="false">http://www.wpbeginner.com/?p=2982</guid>
		<description><![CDATA[
<p>Are you looking to make the most of custom fields on your WordPress website? Custom fields are a handy WordPress feature that allows you to add extra data and information to your WordPress posts and pages. A lot of popular WordPress plugins and themes use&#8230;&#160;<strong><a href="https://www.wpbeginner.com/wp-tutorials/wordpress-custom-fields-101-tips-tricks-and-hacks/">Read More &#187;</a></strong></p>
<p>The post <a href="https://www.wpbeginner.com/wp-tutorials/wordpress-custom-fields-101-tips-tricks-and-hacks/">WordPress Custom Fields 101: Tips, Tricks, and Hacks</a> first appeared on <a href="https://www.wpbeginner.com/">WPBeginner</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Are you looking to make the most of custom fields on your WordPress website? </p>



<p>Custom fields are a handy WordPress feature that allows you to add extra data and information to your WordPress posts and pages. A lot of popular WordPress plugins and themes use custom fields to store important data. </p>



<p>In this article, we will show you how to use WordPress custom fields with some tips, tricks, and hacks.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="680" height="385" src="https://www.wpbeginner.com/wp-content/uploads/2020/04/wordpress-custom-fields-101-tips-tricks-and-hacks.png" alt="WordPress custom fields 101 tips tricks and hacks" class="wp-image-192552" srcset="https://www.wpbeginner.com/wp-content/uploads/2020/04/wordpress-custom-fields-101-tips-tricks-and-hacks.png 680w, https://www.wpbeginner.com/wp-content/uploads/2020/04/wordpress-custom-fields-101-tips-tricks-and-hacks-300x170.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<p>Since this is a long article, we have added a table of contents for easier navigation. Just use the quick links below to jump to the section you want to read:</p>



<div class="wp-block-aioseo-table-of-contents"><ul><li><a href="https://www.wpbeginner.com/wp-tutorials/wordpress-custom-fields-101-tips-tricks-and-hacks/#customfieldsintro">What Are WordPress Custom Fields?</a></li><li><a href="https://www.wpbeginner.com/wp-tutorials/wordpress-custom-fields-101-tips-tricks-and-hacks/#addcustomfields">Adding Custom Fields in WordPress</a></li><li><a href="https://www.wpbeginner.com/wp-tutorials/wordpress-custom-fields-101-tips-tricks-and-hacks/#displaycustomfields">Displaying Custom Fields in WordPress Themes</a></li><li><a href="https://www.wpbeginner.com/wp-tutorials/wordpress-custom-fields-101-tips-tricks-and-hacks/#cfcantfindcustomfield">Troubleshooting: Can&#8217;t Find Custom Field in Dropdown on Post Edit Screen</a></li><li><a href="https://www.wpbeginner.com/wp-tutorials/wordpress-custom-fields-101-tips-tricks-and-hacks/#cfmetaboxes">Creating a User Interface for Custom Fields Using Advanced Custom Fields</a></li><li><a href="https://www.wpbeginner.com/wp-tutorials/wordpress-custom-fields-101-tips-tricks-and-hacks/#aioseo-how-to-hide-empty-custom-fields-with-conditional-statements">How to Hide Empty Custom Fields With Conditional Statements</a></li><li><a href="https://www.wpbeginner.com/wp-tutorials/wordpress-custom-fields-101-tips-tricks-and-hacks/#multiplevalues">Adding Multiple Values to a Custom Field</a></li><li><a href="https://www.wpbeginner.com/wp-tutorials/wordpress-custom-fields-101-tips-tricks-and-hacks/#searchpostsbycf">How to Search Posts by Custom Field in WordPress</a></li><li><a href="https://www.wpbeginner.com/wp-tutorials/wordpress-custom-fields-101-tips-tricks-and-hacks/#querypostsbycf">Displaying Posts With a Specific Custom Key</a></li><li><a href="https://www.wpbeginner.com/wp-tutorials/wordpress-custom-fields-101-tips-tricks-and-hacks/#addguestauthor">How to Add Guest Author Name Using Custom Fields</a></li><li><a href="https://www.wpbeginner.com/wp-tutorials/wordpress-custom-fields-101-tips-tricks-and-hacks/#addcontributors">How to Display Contributors to an Article Using Custom Fields</a></li><li><a href="https://www.wpbeginner.com/wp-tutorials/wordpress-custom-fields-101-tips-tricks-and-hacks/#cfoutofloop">How to Display Custom Fields Outside the Loop in WordPress</a></li><li><a href="https://www.wpbeginner.com/wp-tutorials/wordpress-custom-fields-101-tips-tricks-and-hacks/#customsidebar">Display a Custom Header, Footer, Sidebar Using Custom Fields</a></li><li><a href="https://www.wpbeginner.com/wp-tutorials/wordpress-custom-fields-101-tips-tricks-and-hacks/#feedcontent">Manipulating RSS feed Content With Custom Fields</a></li><li><a href="https://www.wpbeginner.com/wp-tutorials/wordpress-custom-fields-101-tips-tricks-and-hacks/#feedtitle">How to Manipulate RSS Feed Title With Custom Fields</a></li><li><a href="https://www.wpbeginner.com/wp-tutorials/wordpress-custom-fields-101-tips-tricks-and-hacks/#expirepost">How to Set Expiration Date for Posts in WordPress Using Custom Fields</a></li><li><a href="https://www.wpbeginner.com/wp-tutorials/wordpress-custom-fields-101-tips-tricks-and-hacks/#styleposts">How to Style Individual Posts Using Custom Fields</a></li></ul></div>



<h4 class="wp-block-heading" id="customfieldsintro">What Are WordPress Custom Fields?</h4>



<p>WordPress custom fields are metadata used to add extra information to the post or page you are editing.</p>



<p>By default, when you write a new post, page, or any other content type, WordPress saves that content in two different parts. </p>



<p>The first part is the body of your content that you add using the <a href="https://www.wpbeginner.com/beginners-guide/14-tips-for-mastering-the-wordpress-visual-editor/" title="16 Tips for Mastering the WordPress Content Editor">WordPress content editor</a>.</p>



<p>The second part is the information about that content. For example, the title, author, date, time, and more. This information is called metadata.</p>



<p>A <a href="https://www.wpbeginner.com/guides/" title="How to Make a WordPress Website (Ultimate Guide)">WordPress website</a> automatically adds all the required metadata to each post or page you create. You can also create and store your own metadata by using custom fields.</p>



<p>By default, the custom fields option is hidden on the post edit screen. To view it, you need to click on the three-dot menu in the top-right corner of the screen and select &#8216;Preferences&#8217; from the menu.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="680" height="365" src="https://www.wpbeginner.com/wp-content/uploads/2020/04/open-preferences-in-content-editor-1.png" alt="Open preferences in content editor" class="wp-image-192400" title="Post editor options" srcset="https://www.wpbeginner.com/wp-content/uploads/2020/04/open-preferences-in-content-editor-1.png 680w, https://www.wpbeginner.com/wp-content/uploads/2020/04/open-preferences-in-content-editor-1-300x161.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<p>This will open a popup where you need to switch to the &#8216;Panels&#8217; tab and then enable the &#8216;Custom fields&#8217; option. </p>



<p>After that, simply click on the &#8216;Enable &amp; Reload&#8217; button to reload the post editor.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="680" height="348" src="https://www.wpbeginner.com/wp-content/uploads/2020/04/enable-custom-fields-option-1.png" alt="Enable custom fields option" class="wp-image-192406" title="Enable and display custom fields panel" srcset="https://www.wpbeginner.com/wp-content/uploads/2020/04/enable-custom-fields-option-1.png 680w, https://www.wpbeginner.com/wp-content/uploads/2020/04/enable-custom-fields-option-1-300x154.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<p>The post editor will reload, and you will be able to see the Custom Fields panel below the content editor.</p>



<p>Custom fields can be used to add any information related to the post, page, or other content type. This meta information can then be displayed in your theme.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="680" height="337" src="https://www.wpbeginner.com/wp-content/uploads/2020/04/view-customn-fields-in-wordpress.png" alt="View custom fields in WordPress" class="wp-image-192408" title="Custom fields metabox below the post editor" srcset="https://www.wpbeginner.com/wp-content/uploads/2020/04/view-customn-fields-in-wordpress.png 680w, https://www.wpbeginner.com/wp-content/uploads/2020/04/view-customn-fields-in-wordpress-300x150.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<p>However, to do that, you will need to edit your <a href="https://www.wpbeginner.com/showcase/best-wordpress-themes/" title="Most Popular and Best WordPress Themes (Expert Pick)">WordPress theme</a> files.</p>


<div class="wpb-alert style-yellow">

<p><strong>Note:</strong> This tutorial is recommended for users who are already familiar with editing theme files. It is also helpful for aspiring <a href="https://www.wpbeginner.com/showcase/best-wordpress-developer-jobs-sites/" title="Best WordPress Developer Jobs Sites (+ Example Job Template)">WordPress developers</a> who want to learn how to properly use custom fields in their own themes or plugins.</p>

</div>


<p>Having said that, let&#8217;s take a look at how to add and use custom fields in WordPress.</p>



<h4 class="wp-block-heading" id="addcustomfields">Adding Custom Fields in WordPress</h4>



<p>First, you need to open a post or page in the block editor so that you can add custom fields. Then, you must go to the Custom Fields meta box.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="680" height="261" src="https://www.wpbeginner.com/wp-content/uploads/2020/04/adding-custom-field-name-and-value.png" alt="Adding custom field name and value" class="wp-image-192414" title="Adding custom field name and value" srcset="https://www.wpbeginner.com/wp-content/uploads/2020/04/adding-custom-field-name-and-value.png 680w, https://www.wpbeginner.com/wp-content/uploads/2020/04/adding-custom-field-name-and-value-300x115.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<p>Next, you need to provide a Name for your custom field and then enter its Value. Click on the &#8216;Add Custom Field&#8217; button to save it.</p>



<p>The field will be stored and displayed in the Custom Fields meta box like this:</p>



<figure class="wp-block-image size-full is-resized"><img decoding="async" src="https://www.wpbeginner.com/wp-content/uploads/2020/04/view-newly-created-custom-field.png" alt="View newly created custom field" class="wp-image-192415" width="680" title="Saved custom field" srcset="https://www.wpbeginner.com/wp-content/uploads/2020/04/view-newly-created-custom-field.png 690w, https://www.wpbeginner.com/wp-content/uploads/2020/04/view-newly-created-custom-field-300x144.png 300w" sizes="(max-width: 690px) 100vw, 690px" /></figure>



<p>You can edit this custom field any time you want and then just click on the &#8216;Update&#8217; button to save your changes. You can also delete it if you don&#8217;t want to use it anymore. </p>



<p>Now, you need to save your post to store your custom field settings.</p>



<h4 class="wp-block-heading" id="displaycustomfields">Displaying Custom Fields in WordPress Themes</h4>



<p>To display your custom field on your website, you will need to edit your WordPress theme files and code snippets. </p>



<p>We don&#8217;t recommend directly editing the theme files because the slightest mistake can break your website. An easier way to do this is by using <a href="https://wpcode.com/"  rel="noopener" title="WPCode - WordPress Code Snippet Plugin">WPCode</a>. </p>



<p>It is the best code snippet plugin for WordPress that lets you add custom code and manage snippets from your WordPress dashboard. </p>



<p>If you haven&#8217;t done this before, then we also recommend reading our guide on <a href="https://www.wpbeginner.com/beginners-guide/beginners-guide-to-pasting-snippets-from-the-web-into-wordpress/" title="Beginner’s Guide to Pasting Snippets from the Web into WordPress">how to copy and paste code in WordPress</a>.</p>



<p>First, you will need to install and activate the <a href="https://wordpress.org/plugins/insert-headers-and-footers"  title="WPCode Free Code Snippet Plugin for WordPress" rel="noopener">free WPCode plugin</a>. For more details, please see our beginner&#8217;s guide on <a href="https://www.wpbeginner.com/beginners-guide/step-by-step-guide-to-install-a-wordpress-plugin-for-beginners/" title="How to Install a WordPress Plugin – Step by Step for Beginners">how to install a WordPress plugin</a>.</p>



<p>Upon activation, you will need to go to <strong>Code Snippets » + Add Snippet</strong> from the WordPress dashboard and select the &#8216;Add Your Custom Code (New Snippet)&#8217; option.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="680" height="353" src="https://www.wpbeginner.com/wp-content/uploads/2021/01/wpcode-new-snippet.png" alt="Adding a code snippet to your WordPress website" class="wp-image-163262" srcset="https://www.wpbeginner.com/wp-content/uploads/2021/01/wpcode-new-snippet.png 680w, https://www.wpbeginner.com/wp-content/uploads/2021/01/wpcode-new-snippet-300x156.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<p>Now you need to copy this code to add to your theme files:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: php; title: ; notranslate">
&lt;?php echo get_post_meta($post-&gt;ID, 'key', true); ?&gt;
</pre><div class="wpcode-syntax-footer">
		<div class="wpcode-syntax-code-footer-left">Hosted with ❤️ by <strong><a href="https://wpcode.com/" >WPCode</a></strong></div>
		<div class="wpcode-syntax-code-footer-right">
			<svg width="65" height="16" viewBox="0 0 65 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M38.0415 7.99972C38.0415 6.44437 38.4062 5.38018 39.128 4.59879C39.8499 3.80995 40.8769 3.42297 42.1941 3.42297C42.8117 3.42297 43.4071 3.54949 43.9206 3.80251C44.4564 4.05553 44.8582 4.39786 45.1782 4.82204C45.2452 4.9039 45.2601 4.99321 45.2601 5.09739C45.2601 5.2239 45.2155 5.31321 45.1336 5.39507C45.0517 5.47693 44.9624 5.52158 44.8359 5.52158C44.6871 5.52158 44.5829 5.4546 44.4936 5.35042C44.2555 5.03042 43.9429 4.75507 43.5113 4.53925C43.1094 4.32344 42.6555 4.21925 42.1643 4.21925C41.1224 4.21925 40.3336 4.53925 39.7755 5.17925C39.2248 5.81925 38.942 6.68995 38.942 7.96995C38.942 9.30948 39.2173 10.2025 39.7531 10.7979C40.2889 11.3932 41.0927 11.7132 42.1643 11.7132C42.6331 11.7132 43.0573 11.6313 43.4889 11.4379C43.8908 11.2444 44.2331 10.9913 44.4936 10.6267C44.5755 10.5225 44.6871 10.4555 44.8359 10.4555C44.9624 10.4555 45.0517 10.5002 45.1336 10.582C45.2155 10.6639 45.2601 10.7755 45.2601 10.8797C45.2601 10.9616 45.2378 11.0509 45.1782 11.1327C44.8806 11.5569 44.4713 11.8993 43.9206 12.1523C43.3699 12.4053 42.7894 12.5318 42.1717 12.5318C40.8322 12.5318 39.8052 12.1523 39.0982 11.4006C38.3987 10.6788 38.0415 9.59228 38.0415 7.99972Z" fill="#1F2937"></path><path d="M46.9268 11.7654C46.4356 11.237 46.1826 10.4258 46.1826 9.36164C46.1826 8.29745 46.4208 7.50862 46.9045 6.98024C47.3956 6.45187 48.0803 6.19141 48.9733 6.19141C49.8663 6.19141 50.551 6.44443 51.0422 6.98024C51.5333 7.50862 51.764 8.29745 51.764 9.36164C51.764 10.4258 51.5259 11.237 51.0422 11.7654C50.551 12.2937 49.8663 12.5765 48.9733 12.5765C48.1026 12.5765 47.418 12.3012 46.9268 11.7654ZM47.0608 9.36164C47.0608 10.9765 47.7008 11.7877 48.9808 11.7877C50.2608 11.7877 50.9008 10.9765 50.9008 9.36164C50.9008 7.74676 50.2608 6.93559 48.9808 6.93559C47.6933 6.93559 47.0608 7.76908 47.0608 9.36164Z" fill="#1F2937"></path><path d="M52.583 9.3839C52.583 7.25553 53.476 6.31786 55.2472 6.31786C55.6491 6.31786 56.0137 6.39972 56.3337 6.57088C56.6537 6.74204 56.9067 6.93553 57.0556 7.18855V3.84716C57.0556 3.72065 57.1002 3.63135 57.1821 3.54949C57.2639 3.46762 57.3532 3.42297 57.4798 3.42297C57.6063 3.42297 57.6956 3.46762 57.7774 3.54949C57.8593 3.63135 57.9039 3.72065 57.9039 3.84716V9.95693C57.9039 10.8053 57.6658 11.4453 57.1821 11.8918C56.7132 12.3383 56.0732 12.569 55.2844 12.569C54.4137 12.569 53.7291 12.2937 53.2602 11.7579C52.8137 11.2369 52.583 10.4481 52.583 9.3839ZM53.4314 9.3839C53.4314 10.9988 54.0491 11.81 55.3067 11.81C55.8425 11.81 56.2667 11.6611 56.5867 11.3411C56.9067 11.0211 57.0556 10.5746 57.0556 9.95693V8.25274C57.0332 8.23042 57.0109 8.18576 56.9886 8.12623C56.9663 8.05925 56.9067 7.97739 56.7951 7.85088C56.6909 7.72437 56.5793 7.59786 56.4528 7.48623C56.3263 7.38204 56.1551 7.29274 55.9616 7.21088C55.7458 7.12902 55.5374 7.08437 55.2993 7.08437C54.6816 7.08437 54.2351 7.27786 53.8928 7.67972C53.5802 8.08158 53.4314 8.57274 53.4314 9.3839Z" fill="#1F2937"></path><path d="M58.9312 9.36193C58.9312 8.3424 59.1693 7.55356 59.653 7.00286C60.1367 6.45216 60.8065 6.16937 61.6772 6.16937C62.0195 6.16937 62.3395 6.21402 62.5925 6.29588C62.8679 6.37774 63.106 6.48937 63.2772 6.63821C63.4484 6.78705 63.6195 6.93588 63.746 7.12937C63.8725 7.30054 63.9842 7.49402 64.0437 7.7024C64.1107 7.91821 64.1479 8.08193 64.1925 8.25309C64.2372 8.42426 64.2372 8.59542 64.2372 8.76658C64.2372 8.89309 64.2372 8.99728 64.2372 9.06426C64.2372 9.13123 64.2149 9.21309 64.1702 9.31728C64.1479 9.42147 64.0884 9.48844 63.9991 9.53309C63.9172 9.57774 63.8279 9.60007 63.7014 9.60007H59.8316C59.8316 10.2624 60.0028 10.7908 60.3674 11.1777C60.7321 11.5573 61.2232 11.7731 61.8409 11.7731C62.1832 11.7731 62.4809 11.7284 62.7116 11.6243C62.9498 11.5201 63.2028 11.3936 63.4335 11.2001C63.5153 11.1331 63.6046 11.1182 63.6716 11.1182C63.7758 11.1182 63.8651 11.1629 63.947 11.2224C64.0139 11.3043 64.0512 11.3936 64.0512 11.4977C64.0512 11.6019 64.0065 11.7136 63.9023 11.7954C63.8205 11.8773 63.6865 11.9889 63.5377 12.0931C63.3888 12.1973 63.1507 12.2866 62.8307 12.3908C62.5107 12.495 62.1684 12.5396 61.8037 12.5396C60.8884 12.5396 60.1814 12.2866 59.6902 11.7508C59.1916 11.2522 58.9312 10.4484 58.9312 9.36193ZM59.8093 8.87077H63.3888C63.3888 8.61774 63.3665 8.37961 63.307 8.17123C63.2623 7.95542 63.1805 7.76937 63.0539 7.57588C62.9274 7.3824 62.7563 7.23356 62.5181 7.12937C62.28 7.02519 62.0046 6.95821 61.6846 6.95821C61.1116 6.95821 60.68 7.12937 60.3377 7.4717C60.0251 7.80658 59.8316 8.27542 59.8093 8.87077Z" fill="#1F2937"></path><path d="M19.229 4.18977C19.229 3.97395 19.3109 3.78791 19.4671 3.63907C19.616 3.49023 19.8095 3.40837 20.0253 3.40837C20.2188 3.40837 20.3899 3.47535 20.5164 3.57954C20.643 3.68372 20.7323 3.81023 20.7695 3.94419L22.3248 9.51814L23.8355 3.96651C23.8802 3.79535 23.962 3.66884 24.1109 3.56465C24.2597 3.46047 24.4085 3.41581 24.5574 3.41581C24.7285 3.41581 24.8774 3.46047 25.0039 3.56465C25.1304 3.66884 25.242 3.79535 25.2792 3.96651L26.7899 9.51814L28.3453 3.92186C28.3899 3.79535 28.4718 3.66884 28.5983 3.55721C28.7248 3.45302 28.8737 3.38605 29.0895 3.38605C29.3053 3.38605 29.4764 3.45302 29.6253 3.60186C29.7741 3.7507 29.8411 3.92186 29.8411 4.13023C29.8411 4.21209 29.8188 4.3014 29.7964 4.36093L27.5118 11.9591C27.4671 12.1079 27.3853 12.2567 27.2364 12.3386C27.1099 12.4428 26.9611 12.4874 26.7899 12.4874C26.6188 12.4874 26.4699 12.4428 26.3434 12.3386C26.2169 12.2344 26.1276 12.1079 26.0904 11.9367L24.5574 6.4893L23.0244 11.9963C22.9797 12.1674 22.8755 12.294 22.749 12.3981C22.6225 12.5023 22.4513 12.547 22.2802 12.547C22.109 12.547 21.9602 12.5023 21.8337 12.3981C21.7071 12.294 21.5955 12.1674 21.5583 12.0186L19.2737 4.42791C19.2513 4.36093 19.229 4.27907 19.229 4.18977Z" fill="#1F2937"></path><path d="M30.9351 11.8101V4.18967C30.9351 3.97386 31.0169 3.81014 31.1509 3.6613C31.2997 3.51246 31.4932 3.4306 31.709 3.4306H34.2467C35.0802 3.4306 35.7425 3.6613 36.2485 4.13014C36.762 4.59898 37.0374 5.27618 37.0374 6.15432C37.0374 7.04735 36.7844 7.70967 36.2709 8.17851C35.7574 8.64735 35.0802 8.87805 34.269 8.87805H32.4978V11.8176C32.4978 12.0334 32.4309 12.2194 32.282 12.3683C32.1332 12.5171 31.962 12.5841 31.7239 12.5841C31.4858 12.5841 31.322 12.5022 31.1732 12.3534C31.002 12.1897 30.9351 12.0185 30.9351 11.8101ZM32.4755 7.48642H34.1202C34.5444 7.48642 34.8644 7.35991 35.1025 7.12177C35.3406 6.89107 35.4448 6.54874 35.4448 6.12456C35.4448 5.70037 35.3406 5.35805 35.1025 5.12735C34.8644 4.89665 34.5444 4.78502 34.1425 4.78502H32.4978V7.48642H32.4755V7.48642Z" fill="#1F2937"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M14.3916 15.9999H1.64367C0.720884 15.9999 -0.000976562 15.278 -0.000976562 14.3627V1.63709C-0.000976562 0.721738 0.720884 -0.00012207 1.64367 -0.00012207H14.3916C15.3069 -0.00012207 16.0362 0.721738 16.0362 1.63709V14.3627C16.0362 15.278 15.3069 15.9999 14.3916 15.9999ZM3.96553 13.0231C3.88367 13.0231 3.77205 13.0008 3.69019 12.9785C3.30321 12.8296 3.11716 12.4055 3.266 12.0185L6.61484 3.44546C6.76367 3.06592 7.18786 2.87244 7.57484 3.02127C7.96181 3.17011 8.14786 3.5943 7.99902 3.98127L4.66507 12.5543C4.56088 12.852 4.26321 13.0231 3.96553 13.0231ZM8.76554 11.9366C8.91437 12.0855 9.10786 12.1524 9.30135 12.1524C9.49484 12.1524 9.68833 12.0855 9.83716 11.9366L12.4567 9.33941C12.9255 8.87058 12.9255 8.08174 12.4567 7.6129L9.83716 4.99337C9.56181 4.69569 9.09298 4.69569 8.7953 4.99337C8.49763 5.26872 8.49763 5.73755 8.7953 6.03523L11.2065 8.46127L8.77298 10.8873C8.46042 11.1701 8.46042 11.6389 8.76554 11.9366Z" fill="#1F2937"></path></svg>
			<a href="https://library.wpcode.com/use-snippet/" >1-click Use in WordPress</a>
		</div>
		</div></div>


<p>Don&#8217;t forget to replace <code>key</code> with the name of your custom field. </p>



<p>Next, you must enter the code into the &#8216;Code Preview&#8217; area and change the Code Type to &#8216;PHP Snippet&#8217;. </p>



<figure class="wp-block-image size-full"><img decoding="async" width="680" height="267" src="https://www.wpbeginner.com/wp-content/uploads/2020/04/enter-custom-fields-code.png" alt="Enter custom fields code" class="wp-image-192433" srcset="https://www.wpbeginner.com/wp-content/uploads/2020/04/enter-custom-fields-code.png 680w, https://www.wpbeginner.com/wp-content/uploads/2020/04/enter-custom-fields-code-300x118.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<p>For example, we used this code in our demo theme:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: php; title: ; notranslate">
&lt;p&gt;Today's Mood: &lt;?php echo get_post_meta($post-&gt;ID, 'Mood', true); ?&gt;&lt;/p&gt;
</pre><div class="wpcode-syntax-footer">
		<div class="wpcode-syntax-code-footer-left">Hosted with ❤️ by <strong><a href="https://wpcode.com/" >WPCode</a></strong></div>
		<div class="wpcode-syntax-code-footer-right">
			<svg width="65" height="16" viewBox="0 0 65 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M38.0415 7.99972C38.0415 6.44437 38.4062 5.38018 39.128 4.59879C39.8499 3.80995 40.8769 3.42297 42.1941 3.42297C42.8117 3.42297 43.4071 3.54949 43.9206 3.80251C44.4564 4.05553 44.8582 4.39786 45.1782 4.82204C45.2452 4.9039 45.2601 4.99321 45.2601 5.09739C45.2601 5.2239 45.2155 5.31321 45.1336 5.39507C45.0517 5.47693 44.9624 5.52158 44.8359 5.52158C44.6871 5.52158 44.5829 5.4546 44.4936 5.35042C44.2555 5.03042 43.9429 4.75507 43.5113 4.53925C43.1094 4.32344 42.6555 4.21925 42.1643 4.21925C41.1224 4.21925 40.3336 4.53925 39.7755 5.17925C39.2248 5.81925 38.942 6.68995 38.942 7.96995C38.942 9.30948 39.2173 10.2025 39.7531 10.7979C40.2889 11.3932 41.0927 11.7132 42.1643 11.7132C42.6331 11.7132 43.0573 11.6313 43.4889 11.4379C43.8908 11.2444 44.2331 10.9913 44.4936 10.6267C44.5755 10.5225 44.6871 10.4555 44.8359 10.4555C44.9624 10.4555 45.0517 10.5002 45.1336 10.582C45.2155 10.6639 45.2601 10.7755 45.2601 10.8797C45.2601 10.9616 45.2378 11.0509 45.1782 11.1327C44.8806 11.5569 44.4713 11.8993 43.9206 12.1523C43.3699 12.4053 42.7894 12.5318 42.1717 12.5318C40.8322 12.5318 39.8052 12.1523 39.0982 11.4006C38.3987 10.6788 38.0415 9.59228 38.0415 7.99972Z" fill="#1F2937"></path><path d="M46.9268 11.7654C46.4356 11.237 46.1826 10.4258 46.1826 9.36164C46.1826 8.29745 46.4208 7.50862 46.9045 6.98024C47.3956 6.45187 48.0803 6.19141 48.9733 6.19141C49.8663 6.19141 50.551 6.44443 51.0422 6.98024C51.5333 7.50862 51.764 8.29745 51.764 9.36164C51.764 10.4258 51.5259 11.237 51.0422 11.7654C50.551 12.2937 49.8663 12.5765 48.9733 12.5765C48.1026 12.5765 47.418 12.3012 46.9268 11.7654ZM47.0608 9.36164C47.0608 10.9765 47.7008 11.7877 48.9808 11.7877C50.2608 11.7877 50.9008 10.9765 50.9008 9.36164C50.9008 7.74676 50.2608 6.93559 48.9808 6.93559C47.6933 6.93559 47.0608 7.76908 47.0608 9.36164Z" fill="#1F2937"></path><path d="M52.583 9.3839C52.583 7.25553 53.476 6.31786 55.2472 6.31786C55.6491 6.31786 56.0137 6.39972 56.3337 6.57088C56.6537 6.74204 56.9067 6.93553 57.0556 7.18855V3.84716C57.0556 3.72065 57.1002 3.63135 57.1821 3.54949C57.2639 3.46762 57.3532 3.42297 57.4798 3.42297C57.6063 3.42297 57.6956 3.46762 57.7774 3.54949C57.8593 3.63135 57.9039 3.72065 57.9039 3.84716V9.95693C57.9039 10.8053 57.6658 11.4453 57.1821 11.8918C56.7132 12.3383 56.0732 12.569 55.2844 12.569C54.4137 12.569 53.7291 12.2937 53.2602 11.7579C52.8137 11.2369 52.583 10.4481 52.583 9.3839ZM53.4314 9.3839C53.4314 10.9988 54.0491 11.81 55.3067 11.81C55.8425 11.81 56.2667 11.6611 56.5867 11.3411C56.9067 11.0211 57.0556 10.5746 57.0556 9.95693V8.25274C57.0332 8.23042 57.0109 8.18576 56.9886 8.12623C56.9663 8.05925 56.9067 7.97739 56.7951 7.85088C56.6909 7.72437 56.5793 7.59786 56.4528 7.48623C56.3263 7.38204 56.1551 7.29274 55.9616 7.21088C55.7458 7.12902 55.5374 7.08437 55.2993 7.08437C54.6816 7.08437 54.2351 7.27786 53.8928 7.67972C53.5802 8.08158 53.4314 8.57274 53.4314 9.3839Z" fill="#1F2937"></path><path d="M58.9312 9.36193C58.9312 8.3424 59.1693 7.55356 59.653 7.00286C60.1367 6.45216 60.8065 6.16937 61.6772 6.16937C62.0195 6.16937 62.3395 6.21402 62.5925 6.29588C62.8679 6.37774 63.106 6.48937 63.2772 6.63821C63.4484 6.78705 63.6195 6.93588 63.746 7.12937C63.8725 7.30054 63.9842 7.49402 64.0437 7.7024C64.1107 7.91821 64.1479 8.08193 64.1925 8.25309C64.2372 8.42426 64.2372 8.59542 64.2372 8.76658C64.2372 8.89309 64.2372 8.99728 64.2372 9.06426C64.2372 9.13123 64.2149 9.21309 64.1702 9.31728C64.1479 9.42147 64.0884 9.48844 63.9991 9.53309C63.9172 9.57774 63.8279 9.60007 63.7014 9.60007H59.8316C59.8316 10.2624 60.0028 10.7908 60.3674 11.1777C60.7321 11.5573 61.2232 11.7731 61.8409 11.7731C62.1832 11.7731 62.4809 11.7284 62.7116 11.6243C62.9498 11.5201 63.2028 11.3936 63.4335 11.2001C63.5153 11.1331 63.6046 11.1182 63.6716 11.1182C63.7758 11.1182 63.8651 11.1629 63.947 11.2224C64.0139 11.3043 64.0512 11.3936 64.0512 11.4977C64.0512 11.6019 64.0065 11.7136 63.9023 11.7954C63.8205 11.8773 63.6865 11.9889 63.5377 12.0931C63.3888 12.1973 63.1507 12.2866 62.8307 12.3908C62.5107 12.495 62.1684 12.5396 61.8037 12.5396C60.8884 12.5396 60.1814 12.2866 59.6902 11.7508C59.1916 11.2522 58.9312 10.4484 58.9312 9.36193ZM59.8093 8.87077H63.3888C63.3888 8.61774 63.3665 8.37961 63.307 8.17123C63.2623 7.95542 63.1805 7.76937 63.0539 7.57588C62.9274 7.3824 62.7563 7.23356 62.5181 7.12937C62.28 7.02519 62.0046 6.95821 61.6846 6.95821C61.1116 6.95821 60.68 7.12937 60.3377 7.4717C60.0251 7.80658 59.8316 8.27542 59.8093 8.87077Z" fill="#1F2937"></path><path d="M19.229 4.18977C19.229 3.97395 19.3109 3.78791 19.4671 3.63907C19.616 3.49023 19.8095 3.40837 20.0253 3.40837C20.2188 3.40837 20.3899 3.47535 20.5164 3.57954C20.643 3.68372 20.7323 3.81023 20.7695 3.94419L22.3248 9.51814L23.8355 3.96651C23.8802 3.79535 23.962 3.66884 24.1109 3.56465C24.2597 3.46047 24.4085 3.41581 24.5574 3.41581C24.7285 3.41581 24.8774 3.46047 25.0039 3.56465C25.1304 3.66884 25.242 3.79535 25.2792 3.96651L26.7899 9.51814L28.3453 3.92186C28.3899 3.79535 28.4718 3.66884 28.5983 3.55721C28.7248 3.45302 28.8737 3.38605 29.0895 3.38605C29.3053 3.38605 29.4764 3.45302 29.6253 3.60186C29.7741 3.7507 29.8411 3.92186 29.8411 4.13023C29.8411 4.21209 29.8188 4.3014 29.7964 4.36093L27.5118 11.9591C27.4671 12.1079 27.3853 12.2567 27.2364 12.3386C27.1099 12.4428 26.9611 12.4874 26.7899 12.4874C26.6188 12.4874 26.4699 12.4428 26.3434 12.3386C26.2169 12.2344 26.1276 12.1079 26.0904 11.9367L24.5574 6.4893L23.0244 11.9963C22.9797 12.1674 22.8755 12.294 22.749 12.3981C22.6225 12.5023 22.4513 12.547 22.2802 12.547C22.109 12.547 21.9602 12.5023 21.8337 12.3981C21.7071 12.294 21.5955 12.1674 21.5583 12.0186L19.2737 4.42791C19.2513 4.36093 19.229 4.27907 19.229 4.18977Z" fill="#1F2937"></path><path d="M30.9351 11.8101V4.18967C30.9351 3.97386 31.0169 3.81014 31.1509 3.6613C31.2997 3.51246 31.4932 3.4306 31.709 3.4306H34.2467C35.0802 3.4306 35.7425 3.6613 36.2485 4.13014C36.762 4.59898 37.0374 5.27618 37.0374 6.15432C37.0374 7.04735 36.7844 7.70967 36.2709 8.17851C35.7574 8.64735 35.0802 8.87805 34.269 8.87805H32.4978V11.8176C32.4978 12.0334 32.4309 12.2194 32.282 12.3683C32.1332 12.5171 31.962 12.5841 31.7239 12.5841C31.4858 12.5841 31.322 12.5022 31.1732 12.3534C31.002 12.1897 30.9351 12.0185 30.9351 11.8101ZM32.4755 7.48642H34.1202C34.5444 7.48642 34.8644 7.35991 35.1025 7.12177C35.3406 6.89107 35.4448 6.54874 35.4448 6.12456C35.4448 5.70037 35.3406 5.35805 35.1025 5.12735C34.8644 4.89665 34.5444 4.78502 34.1425 4.78502H32.4978V7.48642H32.4755V7.48642Z" fill="#1F2937"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M14.3916 15.9999H1.64367C0.720884 15.9999 -0.000976562 15.278 -0.000976562 14.3627V1.63709C-0.000976562 0.721738 0.720884 -0.00012207 1.64367 -0.00012207H14.3916C15.3069 -0.00012207 16.0362 0.721738 16.0362 1.63709V14.3627C16.0362 15.278 15.3069 15.9999 14.3916 15.9999ZM3.96553 13.0231C3.88367 13.0231 3.77205 13.0008 3.69019 12.9785C3.30321 12.8296 3.11716 12.4055 3.266 12.0185L6.61484 3.44546C6.76367 3.06592 7.18786 2.87244 7.57484 3.02127C7.96181 3.17011 8.14786 3.5943 7.99902 3.98127L4.66507 12.5543C4.56088 12.852 4.26321 13.0231 3.96553 13.0231ZM8.76554 11.9366C8.91437 12.0855 9.10786 12.1524 9.30135 12.1524C9.49484 12.1524 9.68833 12.0855 9.83716 11.9366L12.4567 9.33941C12.9255 8.87058 12.9255 8.08174 12.4567 7.6129L9.83716 4.99337C9.56181 4.69569 9.09298 4.69569 8.7953 4.99337C8.49763 5.26872 8.49763 5.73755 8.7953 6.03523L11.2065 8.46127L8.77298 10.8873C8.46042 11.1701 8.46042 11.6389 8.76554 11.9366Z" fill="#1F2937"></path></svg>
			<a href="https://library.wpcode.com/use-snippet/" >1-click Use in WordPress</a>
		</div>
		</div></div>


<p>From here, you can scroll down to the Insertion section. </p>



<p>Here, you can select where the code will run. By default, WPCode will Auto Insert the code and run it everywhere on your website. </p>



<figure class="wp-block-image size-full"><img decoding="async" width="680" height="366" src="https://www.wpbeginner.com/wp-content/uploads/2016/01/edit-insertion-method-for-code.png" alt="Edit insertion method for code" class="wp-image-187651" srcset="https://www.wpbeginner.com/wp-content/uploads/2016/01/edit-insertion-method-for-code.png 680w, https://www.wpbeginner.com/wp-content/uploads/2016/01/edit-insertion-method-for-code-300x161.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<p>However, you can change this and select where you would like the custom field to appear. </p>



<p>For example, we will choose the &#8216;Page Specific&#8217; tab and select the &#8216;Insert Before Post&#8217; option. This way, the custom field will appear at the beginning of the blog post. </p>



<figure class="wp-block-image size-full"><img decoding="async" width="680" height="218" src="https://www.wpbeginner.com/wp-content/uploads/2020/04/insert-before-post.png" alt="Insert before post" class="wp-image-192436" srcset="https://www.wpbeginner.com/wp-content/uploads/2020/04/insert-before-post.png 680w, https://www.wpbeginner.com/wp-content/uploads/2020/04/insert-before-post-300x96.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<p>You can now save your changes and visit the post where you added the custom field to see it in action.</p>



<p>You can use this custom field in all your other <a href="https://www.wpbeginner.com/start-a-wordpress-blog/" title="How to Start a WordPress Blog (Beginner’s Guide)">WordPress blog</a> posts as well.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="680" height="346" src="https://www.wpbeginner.com/wp-content/uploads/2020/04/displaying-custom-field.png" alt="Displaying custom field" class="wp-image-192429" title="Custom field data displayed in a WordPress theme" srcset="https://www.wpbeginner.com/wp-content/uploads/2020/04/displaying-custom-field.png 680w, https://www.wpbeginner.com/wp-content/uploads/2020/04/displaying-custom-field-300x153.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<p>You can also easily adjust the custom field for different blog posts. Simply create a new post or edit an existing one. </p>



<p>Then, go to the Custom Fields meta box and select your custom field from the dropdown menu and enter its Value.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="680" height="262" src="https://www.wpbeginner.com/wp-content/uploads/2020/04/reuse-custom-field.png" alt="Reuse custom field" class="wp-image-192430" title="Reuse custom field" srcset="https://www.wpbeginner.com/wp-content/uploads/2020/04/reuse-custom-field.png 680w, https://www.wpbeginner.com/wp-content/uploads/2020/04/reuse-custom-field-300x116.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<p>Once you are done, simply click the &#8216;Add Custom Field&#8217; button to save your changes and then publish or update your post.</p>



<h4 class="wp-block-heading" id="cfcantfindcustomfield">Troubleshooting: Can&#8217;t Find Custom Field in Dropdown on Post Edit Screen</h4>



<p>By default, WordPress only loads 30 custom fields in the dropdown menu on the post edit screen. </p>



<p>If you are using WordPress themes and plugins that already use custom fields, then those might appear first in the dropdown menu, and you won&#8217;t be able to see your newly-created custom field.</p>



<p>To fix this issue, you will need to add the following code to your theme&#8217;s <a href="http://www.wpbeginner.com/glossary/functions-php/" title="What is functions.php File in WordPress?">functions.php</a> file or by using <a href="https://wpcode.com/"  title="WPCode - WordPress Code Snippet Plugin" rel="noopener">WPCode</a> (recommended):</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: php; title: ; notranslate">
add_filter( 'postmeta_form_limit', 'meta_limit_increase' );
function meta_limit_increase( $limit ) {
    return 50;
}
</pre><div class="wpcode-syntax-footer">
		<div class="wpcode-syntax-code-footer-left">Hosted with ❤️ by <strong><a href="https://wpcode.com/" >WPCode</a></strong></div>
		<div class="wpcode-syntax-code-footer-right">
			<svg width="65" height="16" viewBox="0 0 65 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M38.0415 7.99972C38.0415 6.44437 38.4062 5.38018 39.128 4.59879C39.8499 3.80995 40.8769 3.42297 42.1941 3.42297C42.8117 3.42297 43.4071 3.54949 43.9206 3.80251C44.4564 4.05553 44.8582 4.39786 45.1782 4.82204C45.2452 4.9039 45.2601 4.99321 45.2601 5.09739C45.2601 5.2239 45.2155 5.31321 45.1336 5.39507C45.0517 5.47693 44.9624 5.52158 44.8359 5.52158C44.6871 5.52158 44.5829 5.4546 44.4936 5.35042C44.2555 5.03042 43.9429 4.75507 43.5113 4.53925C43.1094 4.32344 42.6555 4.21925 42.1643 4.21925C41.1224 4.21925 40.3336 4.53925 39.7755 5.17925C39.2248 5.81925 38.942 6.68995 38.942 7.96995C38.942 9.30948 39.2173 10.2025 39.7531 10.7979C40.2889 11.3932 41.0927 11.7132 42.1643 11.7132C42.6331 11.7132 43.0573 11.6313 43.4889 11.4379C43.8908 11.2444 44.2331 10.9913 44.4936 10.6267C44.5755 10.5225 44.6871 10.4555 44.8359 10.4555C44.9624 10.4555 45.0517 10.5002 45.1336 10.582C45.2155 10.6639 45.2601 10.7755 45.2601 10.8797C45.2601 10.9616 45.2378 11.0509 45.1782 11.1327C44.8806 11.5569 44.4713 11.8993 43.9206 12.1523C43.3699 12.4053 42.7894 12.5318 42.1717 12.5318C40.8322 12.5318 39.8052 12.1523 39.0982 11.4006C38.3987 10.6788 38.0415 9.59228 38.0415 7.99972Z" fill="#1F2937"></path><path d="M46.9268 11.7654C46.4356 11.237 46.1826 10.4258 46.1826 9.36164C46.1826 8.29745 46.4208 7.50862 46.9045 6.98024C47.3956 6.45187 48.0803 6.19141 48.9733 6.19141C49.8663 6.19141 50.551 6.44443 51.0422 6.98024C51.5333 7.50862 51.764 8.29745 51.764 9.36164C51.764 10.4258 51.5259 11.237 51.0422 11.7654C50.551 12.2937 49.8663 12.5765 48.9733 12.5765C48.1026 12.5765 47.418 12.3012 46.9268 11.7654ZM47.0608 9.36164C47.0608 10.9765 47.7008 11.7877 48.9808 11.7877C50.2608 11.7877 50.9008 10.9765 50.9008 9.36164C50.9008 7.74676 50.2608 6.93559 48.9808 6.93559C47.6933 6.93559 47.0608 7.76908 47.0608 9.36164Z" fill="#1F2937"></path><path d="M52.583 9.3839C52.583 7.25553 53.476 6.31786 55.2472 6.31786C55.6491 6.31786 56.0137 6.39972 56.3337 6.57088C56.6537 6.74204 56.9067 6.93553 57.0556 7.18855V3.84716C57.0556 3.72065 57.1002 3.63135 57.1821 3.54949C57.2639 3.46762 57.3532 3.42297 57.4798 3.42297C57.6063 3.42297 57.6956 3.46762 57.7774 3.54949C57.8593 3.63135 57.9039 3.72065 57.9039 3.84716V9.95693C57.9039 10.8053 57.6658 11.4453 57.1821 11.8918C56.7132 12.3383 56.0732 12.569 55.2844 12.569C54.4137 12.569 53.7291 12.2937 53.2602 11.7579C52.8137 11.2369 52.583 10.4481 52.583 9.3839ZM53.4314 9.3839C53.4314 10.9988 54.0491 11.81 55.3067 11.81C55.8425 11.81 56.2667 11.6611 56.5867 11.3411C56.9067 11.0211 57.0556 10.5746 57.0556 9.95693V8.25274C57.0332 8.23042 57.0109 8.18576 56.9886 8.12623C56.9663 8.05925 56.9067 7.97739 56.7951 7.85088C56.6909 7.72437 56.5793 7.59786 56.4528 7.48623C56.3263 7.38204 56.1551 7.29274 55.9616 7.21088C55.7458 7.12902 55.5374 7.08437 55.2993 7.08437C54.6816 7.08437 54.2351 7.27786 53.8928 7.67972C53.5802 8.08158 53.4314 8.57274 53.4314 9.3839Z" fill="#1F2937"></path><path d="M58.9312 9.36193C58.9312 8.3424 59.1693 7.55356 59.653 7.00286C60.1367 6.45216 60.8065 6.16937 61.6772 6.16937C62.0195 6.16937 62.3395 6.21402 62.5925 6.29588C62.8679 6.37774 63.106 6.48937 63.2772 6.63821C63.4484 6.78705 63.6195 6.93588 63.746 7.12937C63.8725 7.30054 63.9842 7.49402 64.0437 7.7024C64.1107 7.91821 64.1479 8.08193 64.1925 8.25309C64.2372 8.42426 64.2372 8.59542 64.2372 8.76658C64.2372 8.89309 64.2372 8.99728 64.2372 9.06426C64.2372 9.13123 64.2149 9.21309 64.1702 9.31728C64.1479 9.42147 64.0884 9.48844 63.9991 9.53309C63.9172 9.57774 63.8279 9.60007 63.7014 9.60007H59.8316C59.8316 10.2624 60.0028 10.7908 60.3674 11.1777C60.7321 11.5573 61.2232 11.7731 61.8409 11.7731C62.1832 11.7731 62.4809 11.7284 62.7116 11.6243C62.9498 11.5201 63.2028 11.3936 63.4335 11.2001C63.5153 11.1331 63.6046 11.1182 63.6716 11.1182C63.7758 11.1182 63.8651 11.1629 63.947 11.2224C64.0139 11.3043 64.0512 11.3936 64.0512 11.4977C64.0512 11.6019 64.0065 11.7136 63.9023 11.7954C63.8205 11.8773 63.6865 11.9889 63.5377 12.0931C63.3888 12.1973 63.1507 12.2866 62.8307 12.3908C62.5107 12.495 62.1684 12.5396 61.8037 12.5396C60.8884 12.5396 60.1814 12.2866 59.6902 11.7508C59.1916 11.2522 58.9312 10.4484 58.9312 9.36193ZM59.8093 8.87077H63.3888C63.3888 8.61774 63.3665 8.37961 63.307 8.17123C63.2623 7.95542 63.1805 7.76937 63.0539 7.57588C62.9274 7.3824 62.7563 7.23356 62.5181 7.12937C62.28 7.02519 62.0046 6.95821 61.6846 6.95821C61.1116 6.95821 60.68 7.12937 60.3377 7.4717C60.0251 7.80658 59.8316 8.27542 59.8093 8.87077Z" fill="#1F2937"></path><path d="M19.229 4.18977C19.229 3.97395 19.3109 3.78791 19.4671 3.63907C19.616 3.49023 19.8095 3.40837 20.0253 3.40837C20.2188 3.40837 20.3899 3.47535 20.5164 3.57954C20.643 3.68372 20.7323 3.81023 20.7695 3.94419L22.3248 9.51814L23.8355 3.96651C23.8802 3.79535 23.962 3.66884 24.1109 3.56465C24.2597 3.46047 24.4085 3.41581 24.5574 3.41581C24.7285 3.41581 24.8774 3.46047 25.0039 3.56465C25.1304 3.66884 25.242 3.79535 25.2792 3.96651L26.7899 9.51814L28.3453 3.92186C28.3899 3.79535 28.4718 3.66884 28.5983 3.55721C28.7248 3.45302 28.8737 3.38605 29.0895 3.38605C29.3053 3.38605 29.4764 3.45302 29.6253 3.60186C29.7741 3.7507 29.8411 3.92186 29.8411 4.13023C29.8411 4.21209 29.8188 4.3014 29.7964 4.36093L27.5118 11.9591C27.4671 12.1079 27.3853 12.2567 27.2364 12.3386C27.1099 12.4428 26.9611 12.4874 26.7899 12.4874C26.6188 12.4874 26.4699 12.4428 26.3434 12.3386C26.2169 12.2344 26.1276 12.1079 26.0904 11.9367L24.5574 6.4893L23.0244 11.9963C22.9797 12.1674 22.8755 12.294 22.749 12.3981C22.6225 12.5023 22.4513 12.547 22.2802 12.547C22.109 12.547 21.9602 12.5023 21.8337 12.3981C21.7071 12.294 21.5955 12.1674 21.5583 12.0186L19.2737 4.42791C19.2513 4.36093 19.229 4.27907 19.229 4.18977Z" fill="#1F2937"></path><path d="M30.9351 11.8101V4.18967C30.9351 3.97386 31.0169 3.81014 31.1509 3.6613C31.2997 3.51246 31.4932 3.4306 31.709 3.4306H34.2467C35.0802 3.4306 35.7425 3.6613 36.2485 4.13014C36.762 4.59898 37.0374 5.27618 37.0374 6.15432C37.0374 7.04735 36.7844 7.70967 36.2709 8.17851C35.7574 8.64735 35.0802 8.87805 34.269 8.87805H32.4978V11.8176C32.4978 12.0334 32.4309 12.2194 32.282 12.3683C32.1332 12.5171 31.962 12.5841 31.7239 12.5841C31.4858 12.5841 31.322 12.5022 31.1732 12.3534C31.002 12.1897 30.9351 12.0185 30.9351 11.8101ZM32.4755 7.48642H34.1202C34.5444 7.48642 34.8644 7.35991 35.1025 7.12177C35.3406 6.89107 35.4448 6.54874 35.4448 6.12456C35.4448 5.70037 35.3406 5.35805 35.1025 5.12735C34.8644 4.89665 34.5444 4.78502 34.1425 4.78502H32.4978V7.48642H32.4755V7.48642Z" fill="#1F2937"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M14.3916 15.9999H1.64367C0.720884 15.9999 -0.000976562 15.278 -0.000976562 14.3627V1.63709C-0.000976562 0.721738 0.720884 -0.00012207 1.64367 -0.00012207H14.3916C15.3069 -0.00012207 16.0362 0.721738 16.0362 1.63709V14.3627C16.0362 15.278 15.3069 15.9999 14.3916 15.9999ZM3.96553 13.0231C3.88367 13.0231 3.77205 13.0008 3.69019 12.9785C3.30321 12.8296 3.11716 12.4055 3.266 12.0185L6.61484 3.44546C6.76367 3.06592 7.18786 2.87244 7.57484 3.02127C7.96181 3.17011 8.14786 3.5943 7.99902 3.98127L4.66507 12.5543C4.56088 12.852 4.26321 13.0231 3.96553 13.0231ZM8.76554 11.9366C8.91437 12.0855 9.10786 12.1524 9.30135 12.1524C9.49484 12.1524 9.68833 12.0855 9.83716 11.9366L12.4567 9.33941C12.9255 8.87058 12.9255 8.08174 12.4567 7.6129L9.83716 4.99337C9.56181 4.69569 9.09298 4.69569 8.7953 4.99337C8.49763 5.26872 8.49763 5.73755 8.7953 6.03523L11.2065 8.46127L8.77298 10.8873C8.46042 11.1701 8.46042 11.6389 8.76554 11.9366Z" fill="#1F2937"></path></svg>
			<a href="https://library.wpcode.com/use-snippet/" >1-click Use in WordPress</a>
		</div>
		</div></div>


<p>The above code will change that limit to 50. If you still can&#8217;t see your custom field, then you can try increasing that limit even further.</p>



<h4 class="wp-block-heading" id="cfmetaboxes">Creating a User Interface for Custom Fields Using Advanced Custom Fields</h4>



<p>As you can see, once you add a custom field, you will have to select the field and enter its value each time you write a post.</p>



<p>If you have many WordPress custom fields or <a href="https://www.wpbeginner.com/plugins/21-great-plugins-to-manage-multi-author-blogs-efficiently-and-successfully/" title="Plugins to Efficiently Manage WordPress Multi-Author Blogs">multiple authors writing on your website</a>, then this is not an ideal solution.</p>



<p>Wouldn&#8217;t it be nice if you could create a user interface where users can fill in a form to add values to your custom fields?</p>



<p>In fact, this is what so many <a href="https://www.wpbeginner.com/showcase/24-must-have-wordpress-plugins-for-business-websites/" title="Must Have WordPress Plugins for Business Websites">popular WordPress plugins</a> already do. </p>



<p>For example, the SEO title and meta description box inside the popular <a href="https://aioseo.com/"  rel="noopener" title="All in One SEO - WordPress SEO Plugin and Toolkit">All in One SEO</a> plugin is a custom meta box:</p>



<figure class="wp-block-image size-full"><img decoding="async" width="680" height="328" src="https://www.wpbeginner.com/wp-content/uploads/2020/04/aioseo-seo-title-and-description.png" alt="AIOSEO SEO title and description" class="wp-image-192444" title="All in One SEO Pack Meta Box" srcset="https://www.wpbeginner.com/wp-content/uploads/2020/04/aioseo-seo-title-and-description.png 680w, https://www.wpbeginner.com/wp-content/uploads/2020/04/aioseo-seo-title-and-description-300x145.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<p>The easiest way to create a user interface for adding custom fields is by using the <a href="https://wordpress.org/plugins/advanced-custom-fields/"  rel="nofollow noopener" title="Advanced Custom Fields">Advanced Custom Fields</a> plugin.</p>



<p>The first thing you need to do is install and activate the <a title="Advanced Custom Fields" href="https://wordpress.org/plugins/advanced-custom-fields/"  rel="nofollow noopener">Advanced Custom Fields</a> plugin. For more details, see our step-by-step guide on <a title="Step by Step Guide to Install a WordPress Plugin for Beginners" href="http://www.wpbeginner.com/beginners-guide/step-by-step-guide-to-install-a-wordpress-plugin-for-beginners/">how to install a WordPress plugin</a>.</p>



<p>Upon activation, you need to visit the <strong>ACF » Field Groups</strong> page and click on the &#8216;Add New&#8217; button.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="680" height="369" src="https://www.wpbeginner.com/wp-content/uploads/2020/04/add-new-field-group.png" alt="Add new field group" class="wp-image-192446" title="Add new field group" srcset="https://www.wpbeginner.com/wp-content/uploads/2020/04/add-new-field-group.png 680w, https://www.wpbeginner.com/wp-content/uploads/2020/04/add-new-field-group-300x163.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<p>A field group is like a container with a set of custom fields. It allows you to add multiple panels of custom fields.</p>



<p>Now, you need to provide a title for your field group and click the &#8216;+ Add Field&#8217; button in the top-right corner.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="680" height="319" src="https://www.wpbeginner.com/wp-content/uploads/2020/04/add-new-field.png" alt="Add new field" class="wp-image-192453" title="Add new field" srcset="https://www.wpbeginner.com/wp-content/uploads/2020/04/add-new-field.png 680w, https://www.wpbeginner.com/wp-content/uploads/2020/04/add-new-field-300x141.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<p>You can now select a field type. </p>



<p>Advanced Custom Fields allows you to create all sorts of fields, including text, image upload, number, dropdown, checkboxes, and more.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="680" height="336" src="https://www.wpbeginner.com/wp-content/uploads/2020/04/select-field-type-and-other-details.png" alt="Select field type and other details" class="wp-image-192459" title="Adding a new fielld" srcset="https://www.wpbeginner.com/wp-content/uploads/2020/04/select-field-type-and-other-details.png 680w, https://www.wpbeginner.com/wp-content/uploads/2020/04/select-field-type-and-other-details-300x148.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<p>Next, you can scroll down to see other options for that particular field, like field name, field label, and default value. You can change them to your own requirements.</p>



<p>You can also add multiple fields to your field group if you want. Once you are finished, just click on the &#8216;Save Changes&#8217; button.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="680" height="324" src="https://www.wpbeginner.com/wp-content/uploads/2020/04/view-new-field-group.png" alt="View new field group" class="wp-image-192460" srcset="https://www.wpbeginner.com/wp-content/uploads/2020/04/view-new-field-group.png 680w, https://www.wpbeginner.com/wp-content/uploads/2020/04/view-new-field-group-300x143.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<p>Next, edit a post or create a new one, and you will see a new panel with your WordPress custom fields below the content editor.</p>



<p>For detailed step-by-step instructions, you can see our guide on how to <a href="https://www.wpbeginner.com/wp-tutorials/how-to-add-custom-meta-boxes-in-wordpress-posts-and-post-types/" title="How to Add Custom Meta Boxes in WordPress Posts and Post Types">add custom meta boxes in WordPress posts and post types</a>.</p>



<h4 class="wp-block-heading" id="aioseo-how-to-hide-empty-custom-fields-with-conditional-statements">How to Hide Empty Custom Fields With Conditional Statements</h4>



<p>So far, we have covered how to create a custom field and display it in your theme.</p>



<p>Now let&#8217;s see how to check that the custom field is not empty before displaying it. To do that, we will modify our code to first check if the field has data in it:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: php; title: ; notranslate">
&lt;?php 

$mood = get_post_meta($post-&gt;ID, 'Mood', true);

if ($mood) { ?&gt;

&lt;p&gt;Today's Mood: &lt;? echo $mood; ?&gt;&lt;/p&gt;

&lt;?php 

} else {
// do nothing;
}

?&gt;
</pre><div class="wpcode-syntax-footer">
		<div class="wpcode-syntax-code-footer-left">Hosted with ❤️ by <strong><a href="https://wpcode.com/" >WPCode</a></strong></div>
		<div class="wpcode-syntax-code-footer-right">
			<svg width="65" height="16" viewBox="0 0 65 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M38.0415 7.99972C38.0415 6.44437 38.4062 5.38018 39.128 4.59879C39.8499 3.80995 40.8769 3.42297 42.1941 3.42297C42.8117 3.42297 43.4071 3.54949 43.9206 3.80251C44.4564 4.05553 44.8582 4.39786 45.1782 4.82204C45.2452 4.9039 45.2601 4.99321 45.2601 5.09739C45.2601 5.2239 45.2155 5.31321 45.1336 5.39507C45.0517 5.47693 44.9624 5.52158 44.8359 5.52158C44.6871 5.52158 44.5829 5.4546 44.4936 5.35042C44.2555 5.03042 43.9429 4.75507 43.5113 4.53925C43.1094 4.32344 42.6555 4.21925 42.1643 4.21925C41.1224 4.21925 40.3336 4.53925 39.7755 5.17925C39.2248 5.81925 38.942 6.68995 38.942 7.96995C38.942 9.30948 39.2173 10.2025 39.7531 10.7979C40.2889 11.3932 41.0927 11.7132 42.1643 11.7132C42.6331 11.7132 43.0573 11.6313 43.4889 11.4379C43.8908 11.2444 44.2331 10.9913 44.4936 10.6267C44.5755 10.5225 44.6871 10.4555 44.8359 10.4555C44.9624 10.4555 45.0517 10.5002 45.1336 10.582C45.2155 10.6639 45.2601 10.7755 45.2601 10.8797C45.2601 10.9616 45.2378 11.0509 45.1782 11.1327C44.8806 11.5569 44.4713 11.8993 43.9206 12.1523C43.3699 12.4053 42.7894 12.5318 42.1717 12.5318C40.8322 12.5318 39.8052 12.1523 39.0982 11.4006C38.3987 10.6788 38.0415 9.59228 38.0415 7.99972Z" fill="#1F2937"></path><path d="M46.9268 11.7654C46.4356 11.237 46.1826 10.4258 46.1826 9.36164C46.1826 8.29745 46.4208 7.50862 46.9045 6.98024C47.3956 6.45187 48.0803 6.19141 48.9733 6.19141C49.8663 6.19141 50.551 6.44443 51.0422 6.98024C51.5333 7.50862 51.764 8.29745 51.764 9.36164C51.764 10.4258 51.5259 11.237 51.0422 11.7654C50.551 12.2937 49.8663 12.5765 48.9733 12.5765C48.1026 12.5765 47.418 12.3012 46.9268 11.7654ZM47.0608 9.36164C47.0608 10.9765 47.7008 11.7877 48.9808 11.7877C50.2608 11.7877 50.9008 10.9765 50.9008 9.36164C50.9008 7.74676 50.2608 6.93559 48.9808 6.93559C47.6933 6.93559 47.0608 7.76908 47.0608 9.36164Z" fill="#1F2937"></path><path d="M52.583 9.3839C52.583 7.25553 53.476 6.31786 55.2472 6.31786C55.6491 6.31786 56.0137 6.39972 56.3337 6.57088C56.6537 6.74204 56.9067 6.93553 57.0556 7.18855V3.84716C57.0556 3.72065 57.1002 3.63135 57.1821 3.54949C57.2639 3.46762 57.3532 3.42297 57.4798 3.42297C57.6063 3.42297 57.6956 3.46762 57.7774 3.54949C57.8593 3.63135 57.9039 3.72065 57.9039 3.84716V9.95693C57.9039 10.8053 57.6658 11.4453 57.1821 11.8918C56.7132 12.3383 56.0732 12.569 55.2844 12.569C54.4137 12.569 53.7291 12.2937 53.2602 11.7579C52.8137 11.2369 52.583 10.4481 52.583 9.3839ZM53.4314 9.3839C53.4314 10.9988 54.0491 11.81 55.3067 11.81C55.8425 11.81 56.2667 11.6611 56.5867 11.3411C56.9067 11.0211 57.0556 10.5746 57.0556 9.95693V8.25274C57.0332 8.23042 57.0109 8.18576 56.9886 8.12623C56.9663 8.05925 56.9067 7.97739 56.7951 7.85088C56.6909 7.72437 56.5793 7.59786 56.4528 7.48623C56.3263 7.38204 56.1551 7.29274 55.9616 7.21088C55.7458 7.12902 55.5374 7.08437 55.2993 7.08437C54.6816 7.08437 54.2351 7.27786 53.8928 7.67972C53.5802 8.08158 53.4314 8.57274 53.4314 9.3839Z" fill="#1F2937"></path><path d="M58.9312 9.36193C58.9312 8.3424 59.1693 7.55356 59.653 7.00286C60.1367 6.45216 60.8065 6.16937 61.6772 6.16937C62.0195 6.16937 62.3395 6.21402 62.5925 6.29588C62.8679 6.37774 63.106 6.48937 63.2772 6.63821C63.4484 6.78705 63.6195 6.93588 63.746 7.12937C63.8725 7.30054 63.9842 7.49402 64.0437 7.7024C64.1107 7.91821 64.1479 8.08193 64.1925 8.25309C64.2372 8.42426 64.2372 8.59542 64.2372 8.76658C64.2372 8.89309 64.2372 8.99728 64.2372 9.06426C64.2372 9.13123 64.2149 9.21309 64.1702 9.31728C64.1479 9.42147 64.0884 9.48844 63.9991 9.53309C63.9172 9.57774 63.8279 9.60007 63.7014 9.60007H59.8316C59.8316 10.2624 60.0028 10.7908 60.3674 11.1777C60.7321 11.5573 61.2232 11.7731 61.8409 11.7731C62.1832 11.7731 62.4809 11.7284 62.7116 11.6243C62.9498 11.5201 63.2028 11.3936 63.4335 11.2001C63.5153 11.1331 63.6046 11.1182 63.6716 11.1182C63.7758 11.1182 63.8651 11.1629 63.947 11.2224C64.0139 11.3043 64.0512 11.3936 64.0512 11.4977C64.0512 11.6019 64.0065 11.7136 63.9023 11.7954C63.8205 11.8773 63.6865 11.9889 63.5377 12.0931C63.3888 12.1973 63.1507 12.2866 62.8307 12.3908C62.5107 12.495 62.1684 12.5396 61.8037 12.5396C60.8884 12.5396 60.1814 12.2866 59.6902 11.7508C59.1916 11.2522 58.9312 10.4484 58.9312 9.36193ZM59.8093 8.87077H63.3888C63.3888 8.61774 63.3665 8.37961 63.307 8.17123C63.2623 7.95542 63.1805 7.76937 63.0539 7.57588C62.9274 7.3824 62.7563 7.23356 62.5181 7.12937C62.28 7.02519 62.0046 6.95821 61.6846 6.95821C61.1116 6.95821 60.68 7.12937 60.3377 7.4717C60.0251 7.80658 59.8316 8.27542 59.8093 8.87077Z" fill="#1F2937"></path><path d="M19.229 4.18977C19.229 3.97395 19.3109 3.78791 19.4671 3.63907C19.616 3.49023 19.8095 3.40837 20.0253 3.40837C20.2188 3.40837 20.3899 3.47535 20.5164 3.57954C20.643 3.68372 20.7323 3.81023 20.7695 3.94419L22.3248 9.51814L23.8355 3.96651C23.8802 3.79535 23.962 3.66884 24.1109 3.56465C24.2597 3.46047 24.4085 3.41581 24.5574 3.41581C24.7285 3.41581 24.8774 3.46047 25.0039 3.56465C25.1304 3.66884 25.242 3.79535 25.2792 3.96651L26.7899 9.51814L28.3453 3.92186C28.3899 3.79535 28.4718 3.66884 28.5983 3.55721C28.7248 3.45302 28.8737 3.38605 29.0895 3.38605C29.3053 3.38605 29.4764 3.45302 29.6253 3.60186C29.7741 3.7507 29.8411 3.92186 29.8411 4.13023C29.8411 4.21209 29.8188 4.3014 29.7964 4.36093L27.5118 11.9591C27.4671 12.1079 27.3853 12.2567 27.2364 12.3386C27.1099 12.4428 26.9611 12.4874 26.7899 12.4874C26.6188 12.4874 26.4699 12.4428 26.3434 12.3386C26.2169 12.2344 26.1276 12.1079 26.0904 11.9367L24.5574 6.4893L23.0244 11.9963C22.9797 12.1674 22.8755 12.294 22.749 12.3981C22.6225 12.5023 22.4513 12.547 22.2802 12.547C22.109 12.547 21.9602 12.5023 21.8337 12.3981C21.7071 12.294 21.5955 12.1674 21.5583 12.0186L19.2737 4.42791C19.2513 4.36093 19.229 4.27907 19.229 4.18977Z" fill="#1F2937"></path><path d="M30.9351 11.8101V4.18967C30.9351 3.97386 31.0169 3.81014 31.1509 3.6613C31.2997 3.51246 31.4932 3.4306 31.709 3.4306H34.2467C35.0802 3.4306 35.7425 3.6613 36.2485 4.13014C36.762 4.59898 37.0374 5.27618 37.0374 6.15432C37.0374 7.04735 36.7844 7.70967 36.2709 8.17851C35.7574 8.64735 35.0802 8.87805 34.269 8.87805H32.4978V11.8176C32.4978 12.0334 32.4309 12.2194 32.282 12.3683C32.1332 12.5171 31.962 12.5841 31.7239 12.5841C31.4858 12.5841 31.322 12.5022 31.1732 12.3534C31.002 12.1897 30.9351 12.0185 30.9351 11.8101ZM32.4755 7.48642H34.1202C34.5444 7.48642 34.8644 7.35991 35.1025 7.12177C35.3406 6.89107 35.4448 6.54874 35.4448 6.12456C35.4448 5.70037 35.3406 5.35805 35.1025 5.12735C34.8644 4.89665 34.5444 4.78502 34.1425 4.78502H32.4978V7.48642H32.4755V7.48642Z" fill="#1F2937"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M14.3916 15.9999H1.64367C0.720884 15.9999 -0.000976562 15.278 -0.000976562 14.3627V1.63709C-0.000976562 0.721738 0.720884 -0.00012207 1.64367 -0.00012207H14.3916C15.3069 -0.00012207 16.0362 0.721738 16.0362 1.63709V14.3627C16.0362 15.278 15.3069 15.9999 14.3916 15.9999ZM3.96553 13.0231C3.88367 13.0231 3.77205 13.0008 3.69019 12.9785C3.30321 12.8296 3.11716 12.4055 3.266 12.0185L6.61484 3.44546C6.76367 3.06592 7.18786 2.87244 7.57484 3.02127C7.96181 3.17011 8.14786 3.5943 7.99902 3.98127L4.66507 12.5543C4.56088 12.852 4.26321 13.0231 3.96553 13.0231ZM8.76554 11.9366C8.91437 12.0855 9.10786 12.1524 9.30135 12.1524C9.49484 12.1524 9.68833 12.0855 9.83716 11.9366L12.4567 9.33941C12.9255 8.87058 12.9255 8.08174 12.4567 7.6129L9.83716 4.99337C9.56181 4.69569 9.09298 4.69569 8.7953 4.99337C8.49763 5.26872 8.49763 5.73755 8.7953 6.03523L11.2065 8.46127L8.77298 10.8873C8.46042 11.1701 8.46042 11.6389 8.76554 11.9366Z" fill="#1F2937"></path></svg>
			<a href="https://library.wpcode.com/use-snippet/" >1-click Use in WordPress</a>
		</div>
		</div></div>


<p>Don&#8217;t forget to replace <code>Mood</code> with your own custom field name.</p>



<h4 class="wp-block-heading" id="multiplevalues">Adding Multiple Values to a Custom Field</h4>



<p>Custom fields can be reused in the same post to add multiple values. You just need to select the field again and add another value to the &#8216;Value&#8217; box.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="680" height="337" src="https://www.wpbeginner.com/wp-content/uploads/2020/04/adding-multiple-values-to-a-custom-field.png" alt="Adding multiple values to a custom field" class="wp-image-192494" title="Adding multiple values to a custom field" srcset="https://www.wpbeginner.com/wp-content/uploads/2020/04/adding-multiple-values-to-a-custom-field.png 680w, https://www.wpbeginner.com/wp-content/uploads/2020/04/adding-multiple-values-to-a-custom-field-300x150.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<p>However, the code we have used in the above examples will only be able to show a single value.</p>



<p>To display all values of a custom field, we need to modify the code and make it return the data in an array. You will need to add the following code to your theme file:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: php; title: ; notranslate">
&lt;?php 
$mood = get_post_meta($post-&gt;ID, 'Mood', false);
if( count( $mood ) != 0 ) { ?&gt;
&lt;p&gt;Today's Mood:&lt;/p&gt;
&lt;ul&gt;
&lt;?php foreach($mood as $mood) {
            echo '&lt;li&gt;'.$mood.'&lt;/li&gt;';
            }
            ?&gt;
&lt;/ul&gt;
&lt;?php 
} else { 
// do nothing; 
}
?&gt;
</pre><div class="wpcode-syntax-footer">
		<div class="wpcode-syntax-code-footer-left">Hosted with ❤️ by <strong><a href="https://wpcode.com/" >WPCode</a></strong></div>
		<div class="wpcode-syntax-code-footer-right">
			<svg width="65" height="16" viewBox="0 0 65 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M38.0415 7.99972C38.0415 6.44437 38.4062 5.38018 39.128 4.59879C39.8499 3.80995 40.8769 3.42297 42.1941 3.42297C42.8117 3.42297 43.4071 3.54949 43.9206 3.80251C44.4564 4.05553 44.8582 4.39786 45.1782 4.82204C45.2452 4.9039 45.2601 4.99321 45.2601 5.09739C45.2601 5.2239 45.2155 5.31321 45.1336 5.39507C45.0517 5.47693 44.9624 5.52158 44.8359 5.52158C44.6871 5.52158 44.5829 5.4546 44.4936 5.35042C44.2555 5.03042 43.9429 4.75507 43.5113 4.53925C43.1094 4.32344 42.6555 4.21925 42.1643 4.21925C41.1224 4.21925 40.3336 4.53925 39.7755 5.17925C39.2248 5.81925 38.942 6.68995 38.942 7.96995C38.942 9.30948 39.2173 10.2025 39.7531 10.7979C40.2889 11.3932 41.0927 11.7132 42.1643 11.7132C42.6331 11.7132 43.0573 11.6313 43.4889 11.4379C43.8908 11.2444 44.2331 10.9913 44.4936 10.6267C44.5755 10.5225 44.6871 10.4555 44.8359 10.4555C44.9624 10.4555 45.0517 10.5002 45.1336 10.582C45.2155 10.6639 45.2601 10.7755 45.2601 10.8797C45.2601 10.9616 45.2378 11.0509 45.1782 11.1327C44.8806 11.5569 44.4713 11.8993 43.9206 12.1523C43.3699 12.4053 42.7894 12.5318 42.1717 12.5318C40.8322 12.5318 39.8052 12.1523 39.0982 11.4006C38.3987 10.6788 38.0415 9.59228 38.0415 7.99972Z" fill="#1F2937"></path><path d="M46.9268 11.7654C46.4356 11.237 46.1826 10.4258 46.1826 9.36164C46.1826 8.29745 46.4208 7.50862 46.9045 6.98024C47.3956 6.45187 48.0803 6.19141 48.9733 6.19141C49.8663 6.19141 50.551 6.44443 51.0422 6.98024C51.5333 7.50862 51.764 8.29745 51.764 9.36164C51.764 10.4258 51.5259 11.237 51.0422 11.7654C50.551 12.2937 49.8663 12.5765 48.9733 12.5765C48.1026 12.5765 47.418 12.3012 46.9268 11.7654ZM47.0608 9.36164C47.0608 10.9765 47.7008 11.7877 48.9808 11.7877C50.2608 11.7877 50.9008 10.9765 50.9008 9.36164C50.9008 7.74676 50.2608 6.93559 48.9808 6.93559C47.6933 6.93559 47.0608 7.76908 47.0608 9.36164Z" fill="#1F2937"></path><path d="M52.583 9.3839C52.583 7.25553 53.476 6.31786 55.2472 6.31786C55.6491 6.31786 56.0137 6.39972 56.3337 6.57088C56.6537 6.74204 56.9067 6.93553 57.0556 7.18855V3.84716C57.0556 3.72065 57.1002 3.63135 57.1821 3.54949C57.2639 3.46762 57.3532 3.42297 57.4798 3.42297C57.6063 3.42297 57.6956 3.46762 57.7774 3.54949C57.8593 3.63135 57.9039 3.72065 57.9039 3.84716V9.95693C57.9039 10.8053 57.6658 11.4453 57.1821 11.8918C56.7132 12.3383 56.0732 12.569 55.2844 12.569C54.4137 12.569 53.7291 12.2937 53.2602 11.7579C52.8137 11.2369 52.583 10.4481 52.583 9.3839ZM53.4314 9.3839C53.4314 10.9988 54.0491 11.81 55.3067 11.81C55.8425 11.81 56.2667 11.6611 56.5867 11.3411C56.9067 11.0211 57.0556 10.5746 57.0556 9.95693V8.25274C57.0332 8.23042 57.0109 8.18576 56.9886 8.12623C56.9663 8.05925 56.9067 7.97739 56.7951 7.85088C56.6909 7.72437 56.5793 7.59786 56.4528 7.48623C56.3263 7.38204 56.1551 7.29274 55.9616 7.21088C55.7458 7.12902 55.5374 7.08437 55.2993 7.08437C54.6816 7.08437 54.2351 7.27786 53.8928 7.67972C53.5802 8.08158 53.4314 8.57274 53.4314 9.3839Z" fill="#1F2937"></path><path d="M58.9312 9.36193C58.9312 8.3424 59.1693 7.55356 59.653 7.00286C60.1367 6.45216 60.8065 6.16937 61.6772 6.16937C62.0195 6.16937 62.3395 6.21402 62.5925 6.29588C62.8679 6.37774 63.106 6.48937 63.2772 6.63821C63.4484 6.78705 63.6195 6.93588 63.746 7.12937C63.8725 7.30054 63.9842 7.49402 64.0437 7.7024C64.1107 7.91821 64.1479 8.08193 64.1925 8.25309C64.2372 8.42426 64.2372 8.59542 64.2372 8.76658C64.2372 8.89309 64.2372 8.99728 64.2372 9.06426C64.2372 9.13123 64.2149 9.21309 64.1702 9.31728C64.1479 9.42147 64.0884 9.48844 63.9991 9.53309C63.9172 9.57774 63.8279 9.60007 63.7014 9.60007H59.8316C59.8316 10.2624 60.0028 10.7908 60.3674 11.1777C60.7321 11.5573 61.2232 11.7731 61.8409 11.7731C62.1832 11.7731 62.4809 11.7284 62.7116 11.6243C62.9498 11.5201 63.2028 11.3936 63.4335 11.2001C63.5153 11.1331 63.6046 11.1182 63.6716 11.1182C63.7758 11.1182 63.8651 11.1629 63.947 11.2224C64.0139 11.3043 64.0512 11.3936 64.0512 11.4977C64.0512 11.6019 64.0065 11.7136 63.9023 11.7954C63.8205 11.8773 63.6865 11.9889 63.5377 12.0931C63.3888 12.1973 63.1507 12.2866 62.8307 12.3908C62.5107 12.495 62.1684 12.5396 61.8037 12.5396C60.8884 12.5396 60.1814 12.2866 59.6902 11.7508C59.1916 11.2522 58.9312 10.4484 58.9312 9.36193ZM59.8093 8.87077H63.3888C63.3888 8.61774 63.3665 8.37961 63.307 8.17123C63.2623 7.95542 63.1805 7.76937 63.0539 7.57588C62.9274 7.3824 62.7563 7.23356 62.5181 7.12937C62.28 7.02519 62.0046 6.95821 61.6846 6.95821C61.1116 6.95821 60.68 7.12937 60.3377 7.4717C60.0251 7.80658 59.8316 8.27542 59.8093 8.87077Z" fill="#1F2937"></path><path d="M19.229 4.18977C19.229 3.97395 19.3109 3.78791 19.4671 3.63907C19.616 3.49023 19.8095 3.40837 20.0253 3.40837C20.2188 3.40837 20.3899 3.47535 20.5164 3.57954C20.643 3.68372 20.7323 3.81023 20.7695 3.94419L22.3248 9.51814L23.8355 3.96651C23.8802 3.79535 23.962 3.66884 24.1109 3.56465C24.2597 3.46047 24.4085 3.41581 24.5574 3.41581C24.7285 3.41581 24.8774 3.46047 25.0039 3.56465C25.1304 3.66884 25.242 3.79535 25.2792 3.96651L26.7899 9.51814L28.3453 3.92186C28.3899 3.79535 28.4718 3.66884 28.5983 3.55721C28.7248 3.45302 28.8737 3.38605 29.0895 3.38605C29.3053 3.38605 29.4764 3.45302 29.6253 3.60186C29.7741 3.7507 29.8411 3.92186 29.8411 4.13023C29.8411 4.21209 29.8188 4.3014 29.7964 4.36093L27.5118 11.9591C27.4671 12.1079 27.3853 12.2567 27.2364 12.3386C27.1099 12.4428 26.9611 12.4874 26.7899 12.4874C26.6188 12.4874 26.4699 12.4428 26.3434 12.3386C26.2169 12.2344 26.1276 12.1079 26.0904 11.9367L24.5574 6.4893L23.0244 11.9963C22.9797 12.1674 22.8755 12.294 22.749 12.3981C22.6225 12.5023 22.4513 12.547 22.2802 12.547C22.109 12.547 21.9602 12.5023 21.8337 12.3981C21.7071 12.294 21.5955 12.1674 21.5583 12.0186L19.2737 4.42791C19.2513 4.36093 19.229 4.27907 19.229 4.18977Z" fill="#1F2937"></path><path d="M30.9351 11.8101V4.18967C30.9351 3.97386 31.0169 3.81014 31.1509 3.6613C31.2997 3.51246 31.4932 3.4306 31.709 3.4306H34.2467C35.0802 3.4306 35.7425 3.6613 36.2485 4.13014C36.762 4.59898 37.0374 5.27618 37.0374 6.15432C37.0374 7.04735 36.7844 7.70967 36.2709 8.17851C35.7574 8.64735 35.0802 8.87805 34.269 8.87805H32.4978V11.8176C32.4978 12.0334 32.4309 12.2194 32.282 12.3683C32.1332 12.5171 31.962 12.5841 31.7239 12.5841C31.4858 12.5841 31.322 12.5022 31.1732 12.3534C31.002 12.1897 30.9351 12.0185 30.9351 11.8101ZM32.4755 7.48642H34.1202C34.5444 7.48642 34.8644 7.35991 35.1025 7.12177C35.3406 6.89107 35.4448 6.54874 35.4448 6.12456C35.4448 5.70037 35.3406 5.35805 35.1025 5.12735C34.8644 4.89665 34.5444 4.78502 34.1425 4.78502H32.4978V7.48642H32.4755V7.48642Z" fill="#1F2937"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M14.3916 15.9999H1.64367C0.720884 15.9999 -0.000976562 15.278 -0.000976562 14.3627V1.63709C-0.000976562 0.721738 0.720884 -0.00012207 1.64367 -0.00012207H14.3916C15.3069 -0.00012207 16.0362 0.721738 16.0362 1.63709V14.3627C16.0362 15.278 15.3069 15.9999 14.3916 15.9999ZM3.96553 13.0231C3.88367 13.0231 3.77205 13.0008 3.69019 12.9785C3.30321 12.8296 3.11716 12.4055 3.266 12.0185L6.61484 3.44546C6.76367 3.06592 7.18786 2.87244 7.57484 3.02127C7.96181 3.17011 8.14786 3.5943 7.99902 3.98127L4.66507 12.5543C4.56088 12.852 4.26321 13.0231 3.96553 13.0231ZM8.76554 11.9366C8.91437 12.0855 9.10786 12.1524 9.30135 12.1524C9.49484 12.1524 9.68833 12.0855 9.83716 11.9366L12.4567 9.33941C12.9255 8.87058 12.9255 8.08174 12.4567 7.6129L9.83716 4.99337C9.56181 4.69569 9.09298 4.69569 8.7953 4.99337C8.49763 5.26872 8.49763 5.73755 8.7953 6.03523L11.2065 8.46127L8.77298 10.8873C8.46042 11.1701 8.46042 11.6389 8.76554 11.9366Z" fill="#1F2937"></path></svg>
			<a href="https://library.wpcode.com/use-snippet/" >1-click Use in WordPress</a>
		</div>
		</div></div>


<p>Again, don&#8217;t forget to replace <code>Mood</code> with your own custom field name.</p>



<p>In this example, you will notice that we have changed the last parameter of <code>get_post_meta</code> function to <code>false</code>. This parameter defines whether the function should return a single value or not. Setting it to <code>false</code> allows it to return the data as an array, which we then displayed in a <code>foreach</code> loop.</p>



<h4 class="wp-block-heading" id="searchpostsbycf">How to Search Posts by Custom Field in WordPress</h4>



<p>WordPress&#8217;s default search doesn&#8217;t work with any custom fields on your website. It only uses the content to find the post you or your visitors are looking for on your site.</p>



<p>However, <a href="https://searchwp.com/"  rel="noopener" title="SearchWP - Advanced WordPress Search Plugin">SearchWP </a>changes that by improving your WordPress search. It&#8217;s the <a href="https://www.wpbeginner.com/showcase/12-wordpress-search-plugins-to-improve-your-site-search/" title="WordPress Search Plugins to Improve Your Site Search">best WordPress search plugin</a> that goes beyond using the post content and indexes everything, including WordPress custom fields, PDF documents, custom tables, text, files, and more.</p>



<p>You can adjust the search algorithm without editing code using SearchWP. Simply <a title="How to Install a WordPress Plugin – Step by Step for Beginners" href="https://www.wpbeginner.com/beginners-guide/step-by-step-guide-to-install-a-wordpress-plugin-for-beginners/">install the plugin</a> and then head over to <strong>SearchWP » Algorithm</strong> from your WordPress admin area.</p>



<p>After that, you need to go to the &#8216;Engines&#8217; tab and then adjust the Attribute Relevance slider. This will change the importance given to each attribute during a search.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="680" height="370" src="https://www.wpbeginner.com/wp-content/uploads/2020/04/adjust-the-search-relevance.png" alt="Adjust the search relevance" class="wp-image-192499" title="SearchWP engines example" srcset="https://www.wpbeginner.com/wp-content/uploads/2020/04/adjust-the-search-relevance.png 680w, https://www.wpbeginner.com/wp-content/uploads/2020/04/adjust-the-search-relevance-300x163.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<p>For instance, you can set the Custom Fields slider to maximum and adjust sliders for other attributes accordingly. This way, SearchWP will give preference to data in custom fields when searching for content in WordPress.</p>



<p>Another advantage of using SearchWP is that works with some of the most popular custom field plugins, including Advanced Custom Fields (ACF), Meta Box, and Pods.</p>



<p>For more details, you can read our beginner-friendly guide on <a href="https://www.wpbeginner.com/plugins/improve-wordpress-search-searchwp/" title="How to Improve WordPress Search with SearchWP (Quick &amp; Easy)">how to improve WordPress search with SearchWP</a>.</p>



<h4 class="wp-block-heading" id="querypostsbycf">Displaying Posts With a Specific Custom Key</h4>



<p>WordPress allows you to display posts with custom keys and their values. For example, if you are trying to create a custom archive page to display all posts with specific custom keys, then you can use the <code>WP_Query</code> class to query posts matching those fields.</p>



<p>You can use the following code as a starting point:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: php; title: ; notranslate">
$args = array(
    'meta_key'   =&gt; 'Mood',
    'meta_value' =&gt; 'Happy'
);
$the_query = new WP_Query( $args );
 
&lt;?php 
// the query
$the_query = new WP_Query( $args ); ?&gt;
 
&lt;?php if ( $the_query-&gt;have_posts() ) : ?&gt;
 
    &lt;!-- the loop --&gt;
    &lt;?php while ( $the_query-&gt;have_posts() ) : $the_query-&gt;the_post(); ?&gt;
        &lt;h2&gt;&lt;?php the_title(); ?&gt;&lt;/h2&gt;
        &lt;?php the_content(); ?&gt;
 
    &lt;?php endwhile; ?&gt;
    &lt;!-- end of the loop --&gt;
 
    &lt;!-- pagination here --&gt;
 
    &lt;?php wp_reset_postdata(); ?&gt;
 
&lt;?php else : ?&gt;
    &lt;p&gt;&lt;?php _e( 'Sorry, no posts matched your criteria.' ); ?&gt;&lt;/p&gt;
&lt;?php endif; ?&gt;
</pre><div class="wpcode-syntax-footer">
		<div class="wpcode-syntax-code-footer-left">Hosted with ❤️ by <strong><a href="https://wpcode.com/" >WPCode</a></strong></div>
		<div class="wpcode-syntax-code-footer-right">
			<svg width="65" height="16" viewBox="0 0 65 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M38.0415 7.99972C38.0415 6.44437 38.4062 5.38018 39.128 4.59879C39.8499 3.80995 40.8769 3.42297 42.1941 3.42297C42.8117 3.42297 43.4071 3.54949 43.9206 3.80251C44.4564 4.05553 44.8582 4.39786 45.1782 4.82204C45.2452 4.9039 45.2601 4.99321 45.2601 5.09739C45.2601 5.2239 45.2155 5.31321 45.1336 5.39507C45.0517 5.47693 44.9624 5.52158 44.8359 5.52158C44.6871 5.52158 44.5829 5.4546 44.4936 5.35042C44.2555 5.03042 43.9429 4.75507 43.5113 4.53925C43.1094 4.32344 42.6555 4.21925 42.1643 4.21925C41.1224 4.21925 40.3336 4.53925 39.7755 5.17925C39.2248 5.81925 38.942 6.68995 38.942 7.96995C38.942 9.30948 39.2173 10.2025 39.7531 10.7979C40.2889 11.3932 41.0927 11.7132 42.1643 11.7132C42.6331 11.7132 43.0573 11.6313 43.4889 11.4379C43.8908 11.2444 44.2331 10.9913 44.4936 10.6267C44.5755 10.5225 44.6871 10.4555 44.8359 10.4555C44.9624 10.4555 45.0517 10.5002 45.1336 10.582C45.2155 10.6639 45.2601 10.7755 45.2601 10.8797C45.2601 10.9616 45.2378 11.0509 45.1782 11.1327C44.8806 11.5569 44.4713 11.8993 43.9206 12.1523C43.3699 12.4053 42.7894 12.5318 42.1717 12.5318C40.8322 12.5318 39.8052 12.1523 39.0982 11.4006C38.3987 10.6788 38.0415 9.59228 38.0415 7.99972Z" fill="#1F2937"></path><path d="M46.9268 11.7654C46.4356 11.237 46.1826 10.4258 46.1826 9.36164C46.1826 8.29745 46.4208 7.50862 46.9045 6.98024C47.3956 6.45187 48.0803 6.19141 48.9733 6.19141C49.8663 6.19141 50.551 6.44443 51.0422 6.98024C51.5333 7.50862 51.764 8.29745 51.764 9.36164C51.764 10.4258 51.5259 11.237 51.0422 11.7654C50.551 12.2937 49.8663 12.5765 48.9733 12.5765C48.1026 12.5765 47.418 12.3012 46.9268 11.7654ZM47.0608 9.36164C47.0608 10.9765 47.7008 11.7877 48.9808 11.7877C50.2608 11.7877 50.9008 10.9765 50.9008 9.36164C50.9008 7.74676 50.2608 6.93559 48.9808 6.93559C47.6933 6.93559 47.0608 7.76908 47.0608 9.36164Z" fill="#1F2937"></path><path d="M52.583 9.3839C52.583 7.25553 53.476 6.31786 55.2472 6.31786C55.6491 6.31786 56.0137 6.39972 56.3337 6.57088C56.6537 6.74204 56.9067 6.93553 57.0556 7.18855V3.84716C57.0556 3.72065 57.1002 3.63135 57.1821 3.54949C57.2639 3.46762 57.3532 3.42297 57.4798 3.42297C57.6063 3.42297 57.6956 3.46762 57.7774 3.54949C57.8593 3.63135 57.9039 3.72065 57.9039 3.84716V9.95693C57.9039 10.8053 57.6658 11.4453 57.1821 11.8918C56.7132 12.3383 56.0732 12.569 55.2844 12.569C54.4137 12.569 53.7291 12.2937 53.2602 11.7579C52.8137 11.2369 52.583 10.4481 52.583 9.3839ZM53.4314 9.3839C53.4314 10.9988 54.0491 11.81 55.3067 11.81C55.8425 11.81 56.2667 11.6611 56.5867 11.3411C56.9067 11.0211 57.0556 10.5746 57.0556 9.95693V8.25274C57.0332 8.23042 57.0109 8.18576 56.9886 8.12623C56.9663 8.05925 56.9067 7.97739 56.7951 7.85088C56.6909 7.72437 56.5793 7.59786 56.4528 7.48623C56.3263 7.38204 56.1551 7.29274 55.9616 7.21088C55.7458 7.12902 55.5374 7.08437 55.2993 7.08437C54.6816 7.08437 54.2351 7.27786 53.8928 7.67972C53.5802 8.08158 53.4314 8.57274 53.4314 9.3839Z" fill="#1F2937"></path><path d="M58.9312 9.36193C58.9312 8.3424 59.1693 7.55356 59.653 7.00286C60.1367 6.45216 60.8065 6.16937 61.6772 6.16937C62.0195 6.16937 62.3395 6.21402 62.5925 6.29588C62.8679 6.37774 63.106 6.48937 63.2772 6.63821C63.4484 6.78705 63.6195 6.93588 63.746 7.12937C63.8725 7.30054 63.9842 7.49402 64.0437 7.7024C64.1107 7.91821 64.1479 8.08193 64.1925 8.25309C64.2372 8.42426 64.2372 8.59542 64.2372 8.76658C64.2372 8.89309 64.2372 8.99728 64.2372 9.06426C64.2372 9.13123 64.2149 9.21309 64.1702 9.31728C64.1479 9.42147 64.0884 9.48844 63.9991 9.53309C63.9172 9.57774 63.8279 9.60007 63.7014 9.60007H59.8316C59.8316 10.2624 60.0028 10.7908 60.3674 11.1777C60.7321 11.5573 61.2232 11.7731 61.8409 11.7731C62.1832 11.7731 62.4809 11.7284 62.7116 11.6243C62.9498 11.5201 63.2028 11.3936 63.4335 11.2001C63.5153 11.1331 63.6046 11.1182 63.6716 11.1182C63.7758 11.1182 63.8651 11.1629 63.947 11.2224C64.0139 11.3043 64.0512 11.3936 64.0512 11.4977C64.0512 11.6019 64.0065 11.7136 63.9023 11.7954C63.8205 11.8773 63.6865 11.9889 63.5377 12.0931C63.3888 12.1973 63.1507 12.2866 62.8307 12.3908C62.5107 12.495 62.1684 12.5396 61.8037 12.5396C60.8884 12.5396 60.1814 12.2866 59.6902 11.7508C59.1916 11.2522 58.9312 10.4484 58.9312 9.36193ZM59.8093 8.87077H63.3888C63.3888 8.61774 63.3665 8.37961 63.307 8.17123C63.2623 7.95542 63.1805 7.76937 63.0539 7.57588C62.9274 7.3824 62.7563 7.23356 62.5181 7.12937C62.28 7.02519 62.0046 6.95821 61.6846 6.95821C61.1116 6.95821 60.68 7.12937 60.3377 7.4717C60.0251 7.80658 59.8316 8.27542 59.8093 8.87077Z" fill="#1F2937"></path><path d="M19.229 4.18977C19.229 3.97395 19.3109 3.78791 19.4671 3.63907C19.616 3.49023 19.8095 3.40837 20.0253 3.40837C20.2188 3.40837 20.3899 3.47535 20.5164 3.57954C20.643 3.68372 20.7323 3.81023 20.7695 3.94419L22.3248 9.51814L23.8355 3.96651C23.8802 3.79535 23.962 3.66884 24.1109 3.56465C24.2597 3.46047 24.4085 3.41581 24.5574 3.41581C24.7285 3.41581 24.8774 3.46047 25.0039 3.56465C25.1304 3.66884 25.242 3.79535 25.2792 3.96651L26.7899 9.51814L28.3453 3.92186C28.3899 3.79535 28.4718 3.66884 28.5983 3.55721C28.7248 3.45302 28.8737 3.38605 29.0895 3.38605C29.3053 3.38605 29.4764 3.45302 29.6253 3.60186C29.7741 3.7507 29.8411 3.92186 29.8411 4.13023C29.8411 4.21209 29.8188 4.3014 29.7964 4.36093L27.5118 11.9591C27.4671 12.1079 27.3853 12.2567 27.2364 12.3386C27.1099 12.4428 26.9611 12.4874 26.7899 12.4874C26.6188 12.4874 26.4699 12.4428 26.3434 12.3386C26.2169 12.2344 26.1276 12.1079 26.0904 11.9367L24.5574 6.4893L23.0244 11.9963C22.9797 12.1674 22.8755 12.294 22.749 12.3981C22.6225 12.5023 22.4513 12.547 22.2802 12.547C22.109 12.547 21.9602 12.5023 21.8337 12.3981C21.7071 12.294 21.5955 12.1674 21.5583 12.0186L19.2737 4.42791C19.2513 4.36093 19.229 4.27907 19.229 4.18977Z" fill="#1F2937"></path><path d="M30.9351 11.8101V4.18967C30.9351 3.97386 31.0169 3.81014 31.1509 3.6613C31.2997 3.51246 31.4932 3.4306 31.709 3.4306H34.2467C35.0802 3.4306 35.7425 3.6613 36.2485 4.13014C36.762 4.59898 37.0374 5.27618 37.0374 6.15432C37.0374 7.04735 36.7844 7.70967 36.2709 8.17851C35.7574 8.64735 35.0802 8.87805 34.269 8.87805H32.4978V11.8176C32.4978 12.0334 32.4309 12.2194 32.282 12.3683C32.1332 12.5171 31.962 12.5841 31.7239 12.5841C31.4858 12.5841 31.322 12.5022 31.1732 12.3534C31.002 12.1897 30.9351 12.0185 30.9351 11.8101ZM32.4755 7.48642H34.1202C34.5444 7.48642 34.8644 7.35991 35.1025 7.12177C35.3406 6.89107 35.4448 6.54874 35.4448 6.12456C35.4448 5.70037 35.3406 5.35805 35.1025 5.12735C34.8644 4.89665 34.5444 4.78502 34.1425 4.78502H32.4978V7.48642H32.4755V7.48642Z" fill="#1F2937"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M14.3916 15.9999H1.64367C0.720884 15.9999 -0.000976562 15.278 -0.000976562 14.3627V1.63709C-0.000976562 0.721738 0.720884 -0.00012207 1.64367 -0.00012207H14.3916C15.3069 -0.00012207 16.0362 0.721738 16.0362 1.63709V14.3627C16.0362 15.278 15.3069 15.9999 14.3916 15.9999ZM3.96553 13.0231C3.88367 13.0231 3.77205 13.0008 3.69019 12.9785C3.30321 12.8296 3.11716 12.4055 3.266 12.0185L6.61484 3.44546C6.76367 3.06592 7.18786 2.87244 7.57484 3.02127C7.96181 3.17011 8.14786 3.5943 7.99902 3.98127L4.66507 12.5543C4.56088 12.852 4.26321 13.0231 3.96553 13.0231ZM8.76554 11.9366C8.91437 12.0855 9.10786 12.1524 9.30135 12.1524C9.49484 12.1524 9.68833 12.0855 9.83716 11.9366L12.4567 9.33941C12.9255 8.87058 12.9255 8.08174 12.4567 7.6129L9.83716 4.99337C9.56181 4.69569 9.09298 4.69569 8.7953 4.99337C8.49763 5.26872 8.49763 5.73755 8.7953 6.03523L11.2065 8.46127L8.77298 10.8873C8.46042 11.1701 8.46042 11.6389 8.76554 11.9366Z" fill="#1F2937"></path></svg>
			<a href="https://library.wpcode.com/use-snippet/" >1-click Use in WordPress</a>
		</div>
		</div></div>


<p>Don&#8217;t forget to replace <code>meta_key</code> and <code>meta_value</code> parameters with your own values.</p>



<h4 class="wp-block-heading" id="addguestauthor">How to Add Guest Author Name Using Custom Fields</h4>



<p>Do you want to add a guest post but don&#8217;t want to <a href="https://www.wpbeginner.com/beginners-guide/how-to-add-new-users-and-authors-to-your-wordpress-blog/" title="How to Add New Users and Authors to Your WordPress Blog">add a new user</a> profile just for that post? An easier method is adding a guest author name as a custom field.</p>



<p>To do this, you will need to add the following code to your theme&#8217;s functions.php file or use <a href="https://wpcode.com/"  title="WPCode - WordPress Code Snippet Plugin" rel="noopener">WPCode</a> (recommended):</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: php; title: ; notranslate">
add_filter( 'the_author', 'guest_author_name' );
add_filter( 'get_the_author_display_name', 'guest_author_name' );
function guest_author_name( $name ) {
global $post;
$author = get_post_meta( $post-&gt;ID, 'guest-author', true );
if ( $author )
$name = $author;
return $name;
}
</pre><div class="wpcode-syntax-footer">
		<div class="wpcode-syntax-code-footer-left">Hosted with ❤️ by <strong><a href="https://wpcode.com/" >WPCode</a></strong></div>
		<div class="wpcode-syntax-code-footer-right">
			<svg width="65" height="16" viewBox="0 0 65 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M38.0415 7.99972C38.0415 6.44437 38.4062 5.38018 39.128 4.59879C39.8499 3.80995 40.8769 3.42297 42.1941 3.42297C42.8117 3.42297 43.4071 3.54949 43.9206 3.80251C44.4564 4.05553 44.8582 4.39786 45.1782 4.82204C45.2452 4.9039 45.2601 4.99321 45.2601 5.09739C45.2601 5.2239 45.2155 5.31321 45.1336 5.39507C45.0517 5.47693 44.9624 5.52158 44.8359 5.52158C44.6871 5.52158 44.5829 5.4546 44.4936 5.35042C44.2555 5.03042 43.9429 4.75507 43.5113 4.53925C43.1094 4.32344 42.6555 4.21925 42.1643 4.21925C41.1224 4.21925 40.3336 4.53925 39.7755 5.17925C39.2248 5.81925 38.942 6.68995 38.942 7.96995C38.942 9.30948 39.2173 10.2025 39.7531 10.7979C40.2889 11.3932 41.0927 11.7132 42.1643 11.7132C42.6331 11.7132 43.0573 11.6313 43.4889 11.4379C43.8908 11.2444 44.2331 10.9913 44.4936 10.6267C44.5755 10.5225 44.6871 10.4555 44.8359 10.4555C44.9624 10.4555 45.0517 10.5002 45.1336 10.582C45.2155 10.6639 45.2601 10.7755 45.2601 10.8797C45.2601 10.9616 45.2378 11.0509 45.1782 11.1327C44.8806 11.5569 44.4713 11.8993 43.9206 12.1523C43.3699 12.4053 42.7894 12.5318 42.1717 12.5318C40.8322 12.5318 39.8052 12.1523 39.0982 11.4006C38.3987 10.6788 38.0415 9.59228 38.0415 7.99972Z" fill="#1F2937"></path><path d="M46.9268 11.7654C46.4356 11.237 46.1826 10.4258 46.1826 9.36164C46.1826 8.29745 46.4208 7.50862 46.9045 6.98024C47.3956 6.45187 48.0803 6.19141 48.9733 6.19141C49.8663 6.19141 50.551 6.44443 51.0422 6.98024C51.5333 7.50862 51.764 8.29745 51.764 9.36164C51.764 10.4258 51.5259 11.237 51.0422 11.7654C50.551 12.2937 49.8663 12.5765 48.9733 12.5765C48.1026 12.5765 47.418 12.3012 46.9268 11.7654ZM47.0608 9.36164C47.0608 10.9765 47.7008 11.7877 48.9808 11.7877C50.2608 11.7877 50.9008 10.9765 50.9008 9.36164C50.9008 7.74676 50.2608 6.93559 48.9808 6.93559C47.6933 6.93559 47.0608 7.76908 47.0608 9.36164Z" fill="#1F2937"></path><path d="M52.583 9.3839C52.583 7.25553 53.476 6.31786 55.2472 6.31786C55.6491 6.31786 56.0137 6.39972 56.3337 6.57088C56.6537 6.74204 56.9067 6.93553 57.0556 7.18855V3.84716C57.0556 3.72065 57.1002 3.63135 57.1821 3.54949C57.2639 3.46762 57.3532 3.42297 57.4798 3.42297C57.6063 3.42297 57.6956 3.46762 57.7774 3.54949C57.8593 3.63135 57.9039 3.72065 57.9039 3.84716V9.95693C57.9039 10.8053 57.6658 11.4453 57.1821 11.8918C56.7132 12.3383 56.0732 12.569 55.2844 12.569C54.4137 12.569 53.7291 12.2937 53.2602 11.7579C52.8137 11.2369 52.583 10.4481 52.583 9.3839ZM53.4314 9.3839C53.4314 10.9988 54.0491 11.81 55.3067 11.81C55.8425 11.81 56.2667 11.6611 56.5867 11.3411C56.9067 11.0211 57.0556 10.5746 57.0556 9.95693V8.25274C57.0332 8.23042 57.0109 8.18576 56.9886 8.12623C56.9663 8.05925 56.9067 7.97739 56.7951 7.85088C56.6909 7.72437 56.5793 7.59786 56.4528 7.48623C56.3263 7.38204 56.1551 7.29274 55.9616 7.21088C55.7458 7.12902 55.5374 7.08437 55.2993 7.08437C54.6816 7.08437 54.2351 7.27786 53.8928 7.67972C53.5802 8.08158 53.4314 8.57274 53.4314 9.3839Z" fill="#1F2937"></path><path d="M58.9312 9.36193C58.9312 8.3424 59.1693 7.55356 59.653 7.00286C60.1367 6.45216 60.8065 6.16937 61.6772 6.16937C62.0195 6.16937 62.3395 6.21402 62.5925 6.29588C62.8679 6.37774 63.106 6.48937 63.2772 6.63821C63.4484 6.78705 63.6195 6.93588 63.746 7.12937C63.8725 7.30054 63.9842 7.49402 64.0437 7.7024C64.1107 7.91821 64.1479 8.08193 64.1925 8.25309C64.2372 8.42426 64.2372 8.59542 64.2372 8.76658C64.2372 8.89309 64.2372 8.99728 64.2372 9.06426C64.2372 9.13123 64.2149 9.21309 64.1702 9.31728C64.1479 9.42147 64.0884 9.48844 63.9991 9.53309C63.9172 9.57774 63.8279 9.60007 63.7014 9.60007H59.8316C59.8316 10.2624 60.0028 10.7908 60.3674 11.1777C60.7321 11.5573 61.2232 11.7731 61.8409 11.7731C62.1832 11.7731 62.4809 11.7284 62.7116 11.6243C62.9498 11.5201 63.2028 11.3936 63.4335 11.2001C63.5153 11.1331 63.6046 11.1182 63.6716 11.1182C63.7758 11.1182 63.8651 11.1629 63.947 11.2224C64.0139 11.3043 64.0512 11.3936 64.0512 11.4977C64.0512 11.6019 64.0065 11.7136 63.9023 11.7954C63.8205 11.8773 63.6865 11.9889 63.5377 12.0931C63.3888 12.1973 63.1507 12.2866 62.8307 12.3908C62.5107 12.495 62.1684 12.5396 61.8037 12.5396C60.8884 12.5396 60.1814 12.2866 59.6902 11.7508C59.1916 11.2522 58.9312 10.4484 58.9312 9.36193ZM59.8093 8.87077H63.3888C63.3888 8.61774 63.3665 8.37961 63.307 8.17123C63.2623 7.95542 63.1805 7.76937 63.0539 7.57588C62.9274 7.3824 62.7563 7.23356 62.5181 7.12937C62.28 7.02519 62.0046 6.95821 61.6846 6.95821C61.1116 6.95821 60.68 7.12937 60.3377 7.4717C60.0251 7.80658 59.8316 8.27542 59.8093 8.87077Z" fill="#1F2937"></path><path d="M19.229 4.18977C19.229 3.97395 19.3109 3.78791 19.4671 3.63907C19.616 3.49023 19.8095 3.40837 20.0253 3.40837C20.2188 3.40837 20.3899 3.47535 20.5164 3.57954C20.643 3.68372 20.7323 3.81023 20.7695 3.94419L22.3248 9.51814L23.8355 3.96651C23.8802 3.79535 23.962 3.66884 24.1109 3.56465C24.2597 3.46047 24.4085 3.41581 24.5574 3.41581C24.7285 3.41581 24.8774 3.46047 25.0039 3.56465C25.1304 3.66884 25.242 3.79535 25.2792 3.96651L26.7899 9.51814L28.3453 3.92186C28.3899 3.79535 28.4718 3.66884 28.5983 3.55721C28.7248 3.45302 28.8737 3.38605 29.0895 3.38605C29.3053 3.38605 29.4764 3.45302 29.6253 3.60186C29.7741 3.7507 29.8411 3.92186 29.8411 4.13023C29.8411 4.21209 29.8188 4.3014 29.7964 4.36093L27.5118 11.9591C27.4671 12.1079 27.3853 12.2567 27.2364 12.3386C27.1099 12.4428 26.9611 12.4874 26.7899 12.4874C26.6188 12.4874 26.4699 12.4428 26.3434 12.3386C26.2169 12.2344 26.1276 12.1079 26.0904 11.9367L24.5574 6.4893L23.0244 11.9963C22.9797 12.1674 22.8755 12.294 22.749 12.3981C22.6225 12.5023 22.4513 12.547 22.2802 12.547C22.109 12.547 21.9602 12.5023 21.8337 12.3981C21.7071 12.294 21.5955 12.1674 21.5583 12.0186L19.2737 4.42791C19.2513 4.36093 19.229 4.27907 19.229 4.18977Z" fill="#1F2937"></path><path d="M30.9351 11.8101V4.18967C30.9351 3.97386 31.0169 3.81014 31.1509 3.6613C31.2997 3.51246 31.4932 3.4306 31.709 3.4306H34.2467C35.0802 3.4306 35.7425 3.6613 36.2485 4.13014C36.762 4.59898 37.0374 5.27618 37.0374 6.15432C37.0374 7.04735 36.7844 7.70967 36.2709 8.17851C35.7574 8.64735 35.0802 8.87805 34.269 8.87805H32.4978V11.8176C32.4978 12.0334 32.4309 12.2194 32.282 12.3683C32.1332 12.5171 31.962 12.5841 31.7239 12.5841C31.4858 12.5841 31.322 12.5022 31.1732 12.3534C31.002 12.1897 30.9351 12.0185 30.9351 11.8101ZM32.4755 7.48642H34.1202C34.5444 7.48642 34.8644 7.35991 35.1025 7.12177C35.3406 6.89107 35.4448 6.54874 35.4448 6.12456C35.4448 5.70037 35.3406 5.35805 35.1025 5.12735C34.8644 4.89665 34.5444 4.78502 34.1425 4.78502H32.4978V7.48642H32.4755V7.48642Z" fill="#1F2937"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M14.3916 15.9999H1.64367C0.720884 15.9999 -0.000976562 15.278 -0.000976562 14.3627V1.63709C-0.000976562 0.721738 0.720884 -0.00012207 1.64367 -0.00012207H14.3916C15.3069 -0.00012207 16.0362 0.721738 16.0362 1.63709V14.3627C16.0362 15.278 15.3069 15.9999 14.3916 15.9999ZM3.96553 13.0231C3.88367 13.0231 3.77205 13.0008 3.69019 12.9785C3.30321 12.8296 3.11716 12.4055 3.266 12.0185L6.61484 3.44546C6.76367 3.06592 7.18786 2.87244 7.57484 3.02127C7.96181 3.17011 8.14786 3.5943 7.99902 3.98127L4.66507 12.5543C4.56088 12.852 4.26321 13.0231 3.96553 13.0231ZM8.76554 11.9366C8.91437 12.0855 9.10786 12.1524 9.30135 12.1524C9.49484 12.1524 9.68833 12.0855 9.83716 11.9366L12.4567 9.33941C12.9255 8.87058 12.9255 8.08174 12.4567 7.6129L9.83716 4.99337C9.56181 4.69569 9.09298 4.69569 8.7953 4.99337C8.49763 5.26872 8.49763 5.73755 8.7953 6.03523L11.2065 8.46127L8.77298 10.8873C8.46042 11.1701 8.46042 11.6389 8.76554 11.9366Z" fill="#1F2937"></path></svg>
			<a href="https://library.wpcode.com/use-snippet/" >1-click Use in WordPress</a>
		</div>
		</div></div>


<p>For more details, please see our guide on <a href="https://www.wpbeginner.com/beginners-guide/beginners-guide-to-pasting-snippets-from-the-web-into-wordpress/" title="Beginner’s Guide to Pasting Snippets from the Web into WordPress">pasting snippets from the web into WordPress</a>. </p>



<p>This code hooks a function to <code>the_author</code> and <code>get_the_author_display_name</code> <a title="What is Filters in WordPress?" href="https://www.wpbeginner.com/glossary/filters/">filters</a> in WordPress.</p>



<p>The function first checks for the guest author&#8217;s name. If it exists, then it replaces the author&#8217;s name with the guest author&#8217;s name.</p>



<p>Now you will need to edit the post where you want to display the guest author&#8217;s name. Go to the Custom Fields meta box, add your guest author name, and finally click on the &#8216;Add Custom Field&#8217; button.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="680" height="222" src="https://www.wpbeginner.com/wp-content/uploads/2020/04/guest-author-custom-field.png" alt="Guest author custom field" class="wp-image-192517" title="Adding guest author custom field" srcset="https://www.wpbeginner.com/wp-content/uploads/2020/04/guest-author-custom-field.png 680w, https://www.wpbeginner.com/wp-content/uploads/2020/04/guest-author-custom-field-300x98.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<p>For more details, see our article on <a href="https://www.wpbeginner.com/wp-tutorials/how-to-rewrite-guest-author-name-with-custom-fields-in-wordpress/" title="How to Rewrite Guest Author Name with Custom Fields in WordPress">how to rewrite guest author names with custom fields in WordPress</a>.</p>



<h4 class="wp-block-heading" id="addcontributors">How to Display Contributors to an Article Using Custom Fields</h4>



<p>On many popular blogs and <a href="https://www.wpbeginner.com/showcase/best-wordpress-newspaper-themes/" title="Best WordPress Newspaper Themes">news sites</a>, many authors contribute to writing a single article. However, WordPress only allows a single author to be associated with a post.</p>



<p>One way to solve this problem is by using the <a href="https://wordpress.org/plugins/co-authors-plus/"  rel="nofollow noopener" title="Co-Authors Plus">Co-Authors Plus</a> plugin. To learn more, see our guide on how to <a href="https://www.wpbeginner.com/plugins/allow-multiple-authors-to-be-associated-with-a-post-in-wordpress/" title="How to Add Multiple Authors (Co-Authors) for Posts in WordPress">add multiple authors to a WordPress post</a>.</p>



<p>Another method is adding contributors as a custom field.</p>



<p>First, you need to edit the post where you want to display co-authors or contributors. Then, scroll down to the Custom Fields meta box and add author names as co-author custom fields.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="680" height="311" src="https://www.wpbeginner.com/wp-content/uploads/2020/04/add-coauthor-custom-fields.png" alt="Add coauthor custom fields" class="wp-image-192524" title="Adding co-author custom field" srcset="https://www.wpbeginner.com/wp-content/uploads/2020/04/add-coauthor-custom-fields.png 680w, https://www.wpbeginner.com/wp-content/uploads/2020/04/add-coauthor-custom-fields-300x137.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<p>Now, you need to add this code to your theme files where you want to show co-authors:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: php; title: ; notranslate">
&lt;?php 
 
$coauthors = get_post_meta($post-&gt;ID, 'co-author', false);
if( count( $coauthors ) != 0 ) { ?&gt;
&lt;ul class=&quot;coauthors&quot;&gt;
&lt;li&gt;Contributors&lt;/li&gt;
&lt;?php foreach($coauthors as $coauthors) { ?&gt;
           &lt;?php echo '&lt;li&gt;'.$coauthors.'&lt;/li&gt;' ;
            }
            ?&gt;
&lt;/ul&gt;
&lt;?php 
} else { 
// do nothing; 
}
?&gt;
</pre><div class="wpcode-syntax-footer">
		<div class="wpcode-syntax-code-footer-left">Hosted with ❤️ by <strong><a href="https://wpcode.com/" >WPCode</a></strong></div>
		<div class="wpcode-syntax-code-footer-right">
			<svg width="65" height="16" viewBox="0 0 65 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M38.0415 7.99972C38.0415 6.44437 38.4062 5.38018 39.128 4.59879C39.8499 3.80995 40.8769 3.42297 42.1941 3.42297C42.8117 3.42297 43.4071 3.54949 43.9206 3.80251C44.4564 4.05553 44.8582 4.39786 45.1782 4.82204C45.2452 4.9039 45.2601 4.99321 45.2601 5.09739C45.2601 5.2239 45.2155 5.31321 45.1336 5.39507C45.0517 5.47693 44.9624 5.52158 44.8359 5.52158C44.6871 5.52158 44.5829 5.4546 44.4936 5.35042C44.2555 5.03042 43.9429 4.75507 43.5113 4.53925C43.1094 4.32344 42.6555 4.21925 42.1643 4.21925C41.1224 4.21925 40.3336 4.53925 39.7755 5.17925C39.2248 5.81925 38.942 6.68995 38.942 7.96995C38.942 9.30948 39.2173 10.2025 39.7531 10.7979C40.2889 11.3932 41.0927 11.7132 42.1643 11.7132C42.6331 11.7132 43.0573 11.6313 43.4889 11.4379C43.8908 11.2444 44.2331 10.9913 44.4936 10.6267C44.5755 10.5225 44.6871 10.4555 44.8359 10.4555C44.9624 10.4555 45.0517 10.5002 45.1336 10.582C45.2155 10.6639 45.2601 10.7755 45.2601 10.8797C45.2601 10.9616 45.2378 11.0509 45.1782 11.1327C44.8806 11.5569 44.4713 11.8993 43.9206 12.1523C43.3699 12.4053 42.7894 12.5318 42.1717 12.5318C40.8322 12.5318 39.8052 12.1523 39.0982 11.4006C38.3987 10.6788 38.0415 9.59228 38.0415 7.99972Z" fill="#1F2937"></path><path d="M46.9268 11.7654C46.4356 11.237 46.1826 10.4258 46.1826 9.36164C46.1826 8.29745 46.4208 7.50862 46.9045 6.98024C47.3956 6.45187 48.0803 6.19141 48.9733 6.19141C49.8663 6.19141 50.551 6.44443 51.0422 6.98024C51.5333 7.50862 51.764 8.29745 51.764 9.36164C51.764 10.4258 51.5259 11.237 51.0422 11.7654C50.551 12.2937 49.8663 12.5765 48.9733 12.5765C48.1026 12.5765 47.418 12.3012 46.9268 11.7654ZM47.0608 9.36164C47.0608 10.9765 47.7008 11.7877 48.9808 11.7877C50.2608 11.7877 50.9008 10.9765 50.9008 9.36164C50.9008 7.74676 50.2608 6.93559 48.9808 6.93559C47.6933 6.93559 47.0608 7.76908 47.0608 9.36164Z" fill="#1F2937"></path><path d="M52.583 9.3839C52.583 7.25553 53.476 6.31786 55.2472 6.31786C55.6491 6.31786 56.0137 6.39972 56.3337 6.57088C56.6537 6.74204 56.9067 6.93553 57.0556 7.18855V3.84716C57.0556 3.72065 57.1002 3.63135 57.1821 3.54949C57.2639 3.46762 57.3532 3.42297 57.4798 3.42297C57.6063 3.42297 57.6956 3.46762 57.7774 3.54949C57.8593 3.63135 57.9039 3.72065 57.9039 3.84716V9.95693C57.9039 10.8053 57.6658 11.4453 57.1821 11.8918C56.7132 12.3383 56.0732 12.569 55.2844 12.569C54.4137 12.569 53.7291 12.2937 53.2602 11.7579C52.8137 11.2369 52.583 10.4481 52.583 9.3839ZM53.4314 9.3839C53.4314 10.9988 54.0491 11.81 55.3067 11.81C55.8425 11.81 56.2667 11.6611 56.5867 11.3411C56.9067 11.0211 57.0556 10.5746 57.0556 9.95693V8.25274C57.0332 8.23042 57.0109 8.18576 56.9886 8.12623C56.9663 8.05925 56.9067 7.97739 56.7951 7.85088C56.6909 7.72437 56.5793 7.59786 56.4528 7.48623C56.3263 7.38204 56.1551 7.29274 55.9616 7.21088C55.7458 7.12902 55.5374 7.08437 55.2993 7.08437C54.6816 7.08437 54.2351 7.27786 53.8928 7.67972C53.5802 8.08158 53.4314 8.57274 53.4314 9.3839Z" fill="#1F2937"></path><path d="M58.9312 9.36193C58.9312 8.3424 59.1693 7.55356 59.653 7.00286C60.1367 6.45216 60.8065 6.16937 61.6772 6.16937C62.0195 6.16937 62.3395 6.21402 62.5925 6.29588C62.8679 6.37774 63.106 6.48937 63.2772 6.63821C63.4484 6.78705 63.6195 6.93588 63.746 7.12937C63.8725 7.30054 63.9842 7.49402 64.0437 7.7024C64.1107 7.91821 64.1479 8.08193 64.1925 8.25309C64.2372 8.42426 64.2372 8.59542 64.2372 8.76658C64.2372 8.89309 64.2372 8.99728 64.2372 9.06426C64.2372 9.13123 64.2149 9.21309 64.1702 9.31728C64.1479 9.42147 64.0884 9.48844 63.9991 9.53309C63.9172 9.57774 63.8279 9.60007 63.7014 9.60007H59.8316C59.8316 10.2624 60.0028 10.7908 60.3674 11.1777C60.7321 11.5573 61.2232 11.7731 61.8409 11.7731C62.1832 11.7731 62.4809 11.7284 62.7116 11.6243C62.9498 11.5201 63.2028 11.3936 63.4335 11.2001C63.5153 11.1331 63.6046 11.1182 63.6716 11.1182C63.7758 11.1182 63.8651 11.1629 63.947 11.2224C64.0139 11.3043 64.0512 11.3936 64.0512 11.4977C64.0512 11.6019 64.0065 11.7136 63.9023 11.7954C63.8205 11.8773 63.6865 11.9889 63.5377 12.0931C63.3888 12.1973 63.1507 12.2866 62.8307 12.3908C62.5107 12.495 62.1684 12.5396 61.8037 12.5396C60.8884 12.5396 60.1814 12.2866 59.6902 11.7508C59.1916 11.2522 58.9312 10.4484 58.9312 9.36193ZM59.8093 8.87077H63.3888C63.3888 8.61774 63.3665 8.37961 63.307 8.17123C63.2623 7.95542 63.1805 7.76937 63.0539 7.57588C62.9274 7.3824 62.7563 7.23356 62.5181 7.12937C62.28 7.02519 62.0046 6.95821 61.6846 6.95821C61.1116 6.95821 60.68 7.12937 60.3377 7.4717C60.0251 7.80658 59.8316 8.27542 59.8093 8.87077Z" fill="#1F2937"></path><path d="M19.229 4.18977C19.229 3.97395 19.3109 3.78791 19.4671 3.63907C19.616 3.49023 19.8095 3.40837 20.0253 3.40837C20.2188 3.40837 20.3899 3.47535 20.5164 3.57954C20.643 3.68372 20.7323 3.81023 20.7695 3.94419L22.3248 9.51814L23.8355 3.96651C23.8802 3.79535 23.962 3.66884 24.1109 3.56465C24.2597 3.46047 24.4085 3.41581 24.5574 3.41581C24.7285 3.41581 24.8774 3.46047 25.0039 3.56465C25.1304 3.66884 25.242 3.79535 25.2792 3.96651L26.7899 9.51814L28.3453 3.92186C28.3899 3.79535 28.4718 3.66884 28.5983 3.55721C28.7248 3.45302 28.8737 3.38605 29.0895 3.38605C29.3053 3.38605 29.4764 3.45302 29.6253 3.60186C29.7741 3.7507 29.8411 3.92186 29.8411 4.13023C29.8411 4.21209 29.8188 4.3014 29.7964 4.36093L27.5118 11.9591C27.4671 12.1079 27.3853 12.2567 27.2364 12.3386C27.1099 12.4428 26.9611 12.4874 26.7899 12.4874C26.6188 12.4874 26.4699 12.4428 26.3434 12.3386C26.2169 12.2344 26.1276 12.1079 26.0904 11.9367L24.5574 6.4893L23.0244 11.9963C22.9797 12.1674 22.8755 12.294 22.749 12.3981C22.6225 12.5023 22.4513 12.547 22.2802 12.547C22.109 12.547 21.9602 12.5023 21.8337 12.3981C21.7071 12.294 21.5955 12.1674 21.5583 12.0186L19.2737 4.42791C19.2513 4.36093 19.229 4.27907 19.229 4.18977Z" fill="#1F2937"></path><path d="M30.9351 11.8101V4.18967C30.9351 3.97386 31.0169 3.81014 31.1509 3.6613C31.2997 3.51246 31.4932 3.4306 31.709 3.4306H34.2467C35.0802 3.4306 35.7425 3.6613 36.2485 4.13014C36.762 4.59898 37.0374 5.27618 37.0374 6.15432C37.0374 7.04735 36.7844 7.70967 36.2709 8.17851C35.7574 8.64735 35.0802 8.87805 34.269 8.87805H32.4978V11.8176C32.4978 12.0334 32.4309 12.2194 32.282 12.3683C32.1332 12.5171 31.962 12.5841 31.7239 12.5841C31.4858 12.5841 31.322 12.5022 31.1732 12.3534C31.002 12.1897 30.9351 12.0185 30.9351 11.8101ZM32.4755 7.48642H34.1202C34.5444 7.48642 34.8644 7.35991 35.1025 7.12177C35.3406 6.89107 35.4448 6.54874 35.4448 6.12456C35.4448 5.70037 35.3406 5.35805 35.1025 5.12735C34.8644 4.89665 34.5444 4.78502 34.1425 4.78502H32.4978V7.48642H32.4755V7.48642Z" fill="#1F2937"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M14.3916 15.9999H1.64367C0.720884 15.9999 -0.000976562 15.278 -0.000976562 14.3627V1.63709C-0.000976562 0.721738 0.720884 -0.00012207 1.64367 -0.00012207H14.3916C15.3069 -0.00012207 16.0362 0.721738 16.0362 1.63709V14.3627C16.0362 15.278 15.3069 15.9999 14.3916 15.9999ZM3.96553 13.0231C3.88367 13.0231 3.77205 13.0008 3.69019 12.9785C3.30321 12.8296 3.11716 12.4055 3.266 12.0185L6.61484 3.44546C6.76367 3.06592 7.18786 2.87244 7.57484 3.02127C7.96181 3.17011 8.14786 3.5943 7.99902 3.98127L4.66507 12.5543C4.56088 12.852 4.26321 13.0231 3.96553 13.0231ZM8.76554 11.9366C8.91437 12.0855 9.10786 12.1524 9.30135 12.1524C9.49484 12.1524 9.68833 12.0855 9.83716 11.9366L12.4567 9.33941C12.9255 8.87058 12.9255 8.08174 12.4567 7.6129L9.83716 4.99337C9.56181 4.69569 9.09298 4.69569 8.7953 4.99337C8.49763 5.26872 8.49763 5.73755 8.7953 6.03523L11.2065 8.46127L8.77298 10.8873C8.46042 11.1701 8.46042 11.6389 8.76554 11.9366Z" fill="#1F2937"></path></svg>
			<a href="https://library.wpcode.com/use-snippet/" >1-click Use in WordPress</a>
		</div>
		</div></div>


<p>To display author names separated by commas, you can add the following <a href="https://www.wpbeginner.com/plugins/how-to-easily-add-custom-css-to-your-wordpress-site/" title="How to Easily Add Custom CSS to Your WordPress Site">custom CSS</a>:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: css; title: ; notranslate">
.coauthors ul { 
display:inline;
}
.coauthors li { 
display:inline;
list-style:none;
}
.coauthors li:after { 
content:","
}
.coauthors li:last-child:after {
    content: "";
}
.coauthors li:first-child:after {
    content: ":";
}
</pre><div class="wpcode-syntax-footer">
		<div class="wpcode-syntax-code-footer-left">Hosted with ❤️ by <strong><a href="https://wpcode.com/" >WPCode</a></strong></div>
		<div class="wpcode-syntax-code-footer-right">
			<svg width="65" height="16" viewBox="0 0 65 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M38.0415 7.99972C38.0415 6.44437 38.4062 5.38018 39.128 4.59879C39.8499 3.80995 40.8769 3.42297 42.1941 3.42297C42.8117 3.42297 43.4071 3.54949 43.9206 3.80251C44.4564 4.05553 44.8582 4.39786 45.1782 4.82204C45.2452 4.9039 45.2601 4.99321 45.2601 5.09739C45.2601 5.2239 45.2155 5.31321 45.1336 5.39507C45.0517 5.47693 44.9624 5.52158 44.8359 5.52158C44.6871 5.52158 44.5829 5.4546 44.4936 5.35042C44.2555 5.03042 43.9429 4.75507 43.5113 4.53925C43.1094 4.32344 42.6555 4.21925 42.1643 4.21925C41.1224 4.21925 40.3336 4.53925 39.7755 5.17925C39.2248 5.81925 38.942 6.68995 38.942 7.96995C38.942 9.30948 39.2173 10.2025 39.7531 10.7979C40.2889 11.3932 41.0927 11.7132 42.1643 11.7132C42.6331 11.7132 43.0573 11.6313 43.4889 11.4379C43.8908 11.2444 44.2331 10.9913 44.4936 10.6267C44.5755 10.5225 44.6871 10.4555 44.8359 10.4555C44.9624 10.4555 45.0517 10.5002 45.1336 10.582C45.2155 10.6639 45.2601 10.7755 45.2601 10.8797C45.2601 10.9616 45.2378 11.0509 45.1782 11.1327C44.8806 11.5569 44.4713 11.8993 43.9206 12.1523C43.3699 12.4053 42.7894 12.5318 42.1717 12.5318C40.8322 12.5318 39.8052 12.1523 39.0982 11.4006C38.3987 10.6788 38.0415 9.59228 38.0415 7.99972Z" fill="#1F2937"></path><path d="M46.9268 11.7654C46.4356 11.237 46.1826 10.4258 46.1826 9.36164C46.1826 8.29745 46.4208 7.50862 46.9045 6.98024C47.3956 6.45187 48.0803 6.19141 48.9733 6.19141C49.8663 6.19141 50.551 6.44443 51.0422 6.98024C51.5333 7.50862 51.764 8.29745 51.764 9.36164C51.764 10.4258 51.5259 11.237 51.0422 11.7654C50.551 12.2937 49.8663 12.5765 48.9733 12.5765C48.1026 12.5765 47.418 12.3012 46.9268 11.7654ZM47.0608 9.36164C47.0608 10.9765 47.7008 11.7877 48.9808 11.7877C50.2608 11.7877 50.9008 10.9765 50.9008 9.36164C50.9008 7.74676 50.2608 6.93559 48.9808 6.93559C47.6933 6.93559 47.0608 7.76908 47.0608 9.36164Z" fill="#1F2937"></path><path d="M52.583 9.3839C52.583 7.25553 53.476 6.31786 55.2472 6.31786C55.6491 6.31786 56.0137 6.39972 56.3337 6.57088C56.6537 6.74204 56.9067 6.93553 57.0556 7.18855V3.84716C57.0556 3.72065 57.1002 3.63135 57.1821 3.54949C57.2639 3.46762 57.3532 3.42297 57.4798 3.42297C57.6063 3.42297 57.6956 3.46762 57.7774 3.54949C57.8593 3.63135 57.9039 3.72065 57.9039 3.84716V9.95693C57.9039 10.8053 57.6658 11.4453 57.1821 11.8918C56.7132 12.3383 56.0732 12.569 55.2844 12.569C54.4137 12.569 53.7291 12.2937 53.2602 11.7579C52.8137 11.2369 52.583 10.4481 52.583 9.3839ZM53.4314 9.3839C53.4314 10.9988 54.0491 11.81 55.3067 11.81C55.8425 11.81 56.2667 11.6611 56.5867 11.3411C56.9067 11.0211 57.0556 10.5746 57.0556 9.95693V8.25274C57.0332 8.23042 57.0109 8.18576 56.9886 8.12623C56.9663 8.05925 56.9067 7.97739 56.7951 7.85088C56.6909 7.72437 56.5793 7.59786 56.4528 7.48623C56.3263 7.38204 56.1551 7.29274 55.9616 7.21088C55.7458 7.12902 55.5374 7.08437 55.2993 7.08437C54.6816 7.08437 54.2351 7.27786 53.8928 7.67972C53.5802 8.08158 53.4314 8.57274 53.4314 9.3839Z" fill="#1F2937"></path><path d="M58.9312 9.36193C58.9312 8.3424 59.1693 7.55356 59.653 7.00286C60.1367 6.45216 60.8065 6.16937 61.6772 6.16937C62.0195 6.16937 62.3395 6.21402 62.5925 6.29588C62.8679 6.37774 63.106 6.48937 63.2772 6.63821C63.4484 6.78705 63.6195 6.93588 63.746 7.12937C63.8725 7.30054 63.9842 7.49402 64.0437 7.7024C64.1107 7.91821 64.1479 8.08193 64.1925 8.25309C64.2372 8.42426 64.2372 8.59542 64.2372 8.76658C64.2372 8.89309 64.2372 8.99728 64.2372 9.06426C64.2372 9.13123 64.2149 9.21309 64.1702 9.31728C64.1479 9.42147 64.0884 9.48844 63.9991 9.53309C63.9172 9.57774 63.8279 9.60007 63.7014 9.60007H59.8316C59.8316 10.2624 60.0028 10.7908 60.3674 11.1777C60.7321 11.5573 61.2232 11.7731 61.8409 11.7731C62.1832 11.7731 62.4809 11.7284 62.7116 11.6243C62.9498 11.5201 63.2028 11.3936 63.4335 11.2001C63.5153 11.1331 63.6046 11.1182 63.6716 11.1182C63.7758 11.1182 63.8651 11.1629 63.947 11.2224C64.0139 11.3043 64.0512 11.3936 64.0512 11.4977C64.0512 11.6019 64.0065 11.7136 63.9023 11.7954C63.8205 11.8773 63.6865 11.9889 63.5377 12.0931C63.3888 12.1973 63.1507 12.2866 62.8307 12.3908C62.5107 12.495 62.1684 12.5396 61.8037 12.5396C60.8884 12.5396 60.1814 12.2866 59.6902 11.7508C59.1916 11.2522 58.9312 10.4484 58.9312 9.36193ZM59.8093 8.87077H63.3888C63.3888 8.61774 63.3665 8.37961 63.307 8.17123C63.2623 7.95542 63.1805 7.76937 63.0539 7.57588C62.9274 7.3824 62.7563 7.23356 62.5181 7.12937C62.28 7.02519 62.0046 6.95821 61.6846 6.95821C61.1116 6.95821 60.68 7.12937 60.3377 7.4717C60.0251 7.80658 59.8316 8.27542 59.8093 8.87077Z" fill="#1F2937"></path><path d="M19.229 4.18977C19.229 3.97395 19.3109 3.78791 19.4671 3.63907C19.616 3.49023 19.8095 3.40837 20.0253 3.40837C20.2188 3.40837 20.3899 3.47535 20.5164 3.57954C20.643 3.68372 20.7323 3.81023 20.7695 3.94419L22.3248 9.51814L23.8355 3.96651C23.8802 3.79535 23.962 3.66884 24.1109 3.56465C24.2597 3.46047 24.4085 3.41581 24.5574 3.41581C24.7285 3.41581 24.8774 3.46047 25.0039 3.56465C25.1304 3.66884 25.242 3.79535 25.2792 3.96651L26.7899 9.51814L28.3453 3.92186C28.3899 3.79535 28.4718 3.66884 28.5983 3.55721C28.7248 3.45302 28.8737 3.38605 29.0895 3.38605C29.3053 3.38605 29.4764 3.45302 29.6253 3.60186C29.7741 3.7507 29.8411 3.92186 29.8411 4.13023C29.8411 4.21209 29.8188 4.3014 29.7964 4.36093L27.5118 11.9591C27.4671 12.1079 27.3853 12.2567 27.2364 12.3386C27.1099 12.4428 26.9611 12.4874 26.7899 12.4874C26.6188 12.4874 26.4699 12.4428 26.3434 12.3386C26.2169 12.2344 26.1276 12.1079 26.0904 11.9367L24.5574 6.4893L23.0244 11.9963C22.9797 12.1674 22.8755 12.294 22.749 12.3981C22.6225 12.5023 22.4513 12.547 22.2802 12.547C22.109 12.547 21.9602 12.5023 21.8337 12.3981C21.7071 12.294 21.5955 12.1674 21.5583 12.0186L19.2737 4.42791C19.2513 4.36093 19.229 4.27907 19.229 4.18977Z" fill="#1F2937"></path><path d="M30.9351 11.8101V4.18967C30.9351 3.97386 31.0169 3.81014 31.1509 3.6613C31.2997 3.51246 31.4932 3.4306 31.709 3.4306H34.2467C35.0802 3.4306 35.7425 3.6613 36.2485 4.13014C36.762 4.59898 37.0374 5.27618 37.0374 6.15432C37.0374 7.04735 36.7844 7.70967 36.2709 8.17851C35.7574 8.64735 35.0802 8.87805 34.269 8.87805H32.4978V11.8176C32.4978 12.0334 32.4309 12.2194 32.282 12.3683C32.1332 12.5171 31.962 12.5841 31.7239 12.5841C31.4858 12.5841 31.322 12.5022 31.1732 12.3534C31.002 12.1897 30.9351 12.0185 30.9351 11.8101ZM32.4755 7.48642H34.1202C34.5444 7.48642 34.8644 7.35991 35.1025 7.12177C35.3406 6.89107 35.4448 6.54874 35.4448 6.12456C35.4448 5.70037 35.3406 5.35805 35.1025 5.12735C34.8644 4.89665 34.5444 4.78502 34.1425 4.78502H32.4978V7.48642H32.4755V7.48642Z" fill="#1F2937"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M14.3916 15.9999H1.64367C0.720884 15.9999 -0.000976562 15.278 -0.000976562 14.3627V1.63709C-0.000976562 0.721738 0.720884 -0.00012207 1.64367 -0.00012207H14.3916C15.3069 -0.00012207 16.0362 0.721738 16.0362 1.63709V14.3627C16.0362 15.278 15.3069 15.9999 14.3916 15.9999ZM3.96553 13.0231C3.88367 13.0231 3.77205 13.0008 3.69019 12.9785C3.30321 12.8296 3.11716 12.4055 3.266 12.0185L6.61484 3.44546C6.76367 3.06592 7.18786 2.87244 7.57484 3.02127C7.96181 3.17011 8.14786 3.5943 7.99902 3.98127L4.66507 12.5543C4.56088 12.852 4.26321 13.0231 3.96553 13.0231ZM8.76554 11.9366C8.91437 12.0855 9.10786 12.1524 9.30135 12.1524C9.49484 12.1524 9.68833 12.0855 9.83716 11.9366L12.4567 9.33941C12.9255 8.87058 12.9255 8.08174 12.4567 7.6129L9.83716 4.99337C9.56181 4.69569 9.09298 4.69569 8.7953 4.99337C8.49763 5.26872 8.49763 5.73755 8.7953 6.03523L11.2065 8.46127L8.77298 10.8873C8.46042 11.1701 8.46042 11.6389 8.76554 11.9366Z" fill="#1F2937"></path></svg>
			<a href="https://library.wpcode.com/use-snippet/" >1-click Use in WordPress</a>
		</div>
		</div></div>


<p>This is how it looked on our demo site.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="680" height="310" src="https://www.wpbeginner.com/wp-content/uploads/2020/04/coauthors-custom-fields-preview.png" alt="Coauthors custom fields preview" class="wp-image-192530" title="Co-authors displayed using custom fields" srcset="https://www.wpbeginner.com/wp-content/uploads/2020/04/coauthors-custom-fields-preview.png 680w, https://www.wpbeginner.com/wp-content/uploads/2020/04/coauthors-custom-fields-preview-300x137.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<h4 class="wp-block-heading" id="cfoutofloop">How to Display Custom Fields Outside the Loop in WordPress</h4>



<p>What if you need to show custom fields in the sidebar of a single post?</p>



<p>To display the custom fields outside the WordPress loop, you can add the following code to your theme files:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: php; title: ; notranslate">
&lt;?php
global $wp_query;
$postid = $wp_query-&gt;post-&gt;ID;
echo get_post_meta($postid, 'key', true);
wp_reset_query();
?&gt;
</pre><div class="wpcode-syntax-footer">
		<div class="wpcode-syntax-code-footer-left">Hosted with ❤️ by <strong><a href="https://wpcode.com/" >WPCode</a></strong></div>
		<div class="wpcode-syntax-code-footer-right">
			<svg width="65" height="16" viewBox="0 0 65 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M38.0415 7.99972C38.0415 6.44437 38.4062 5.38018 39.128 4.59879C39.8499 3.80995 40.8769 3.42297 42.1941 3.42297C42.8117 3.42297 43.4071 3.54949 43.9206 3.80251C44.4564 4.05553 44.8582 4.39786 45.1782 4.82204C45.2452 4.9039 45.2601 4.99321 45.2601 5.09739C45.2601 5.2239 45.2155 5.31321 45.1336 5.39507C45.0517 5.47693 44.9624 5.52158 44.8359 5.52158C44.6871 5.52158 44.5829 5.4546 44.4936 5.35042C44.2555 5.03042 43.9429 4.75507 43.5113 4.53925C43.1094 4.32344 42.6555 4.21925 42.1643 4.21925C41.1224 4.21925 40.3336 4.53925 39.7755 5.17925C39.2248 5.81925 38.942 6.68995 38.942 7.96995C38.942 9.30948 39.2173 10.2025 39.7531 10.7979C40.2889 11.3932 41.0927 11.7132 42.1643 11.7132C42.6331 11.7132 43.0573 11.6313 43.4889 11.4379C43.8908 11.2444 44.2331 10.9913 44.4936 10.6267C44.5755 10.5225 44.6871 10.4555 44.8359 10.4555C44.9624 10.4555 45.0517 10.5002 45.1336 10.582C45.2155 10.6639 45.2601 10.7755 45.2601 10.8797C45.2601 10.9616 45.2378 11.0509 45.1782 11.1327C44.8806 11.5569 44.4713 11.8993 43.9206 12.1523C43.3699 12.4053 42.7894 12.5318 42.1717 12.5318C40.8322 12.5318 39.8052 12.1523 39.0982 11.4006C38.3987 10.6788 38.0415 9.59228 38.0415 7.99972Z" fill="#1F2937"></path><path d="M46.9268 11.7654C46.4356 11.237 46.1826 10.4258 46.1826 9.36164C46.1826 8.29745 46.4208 7.50862 46.9045 6.98024C47.3956 6.45187 48.0803 6.19141 48.9733 6.19141C49.8663 6.19141 50.551 6.44443 51.0422 6.98024C51.5333 7.50862 51.764 8.29745 51.764 9.36164C51.764 10.4258 51.5259 11.237 51.0422 11.7654C50.551 12.2937 49.8663 12.5765 48.9733 12.5765C48.1026 12.5765 47.418 12.3012 46.9268 11.7654ZM47.0608 9.36164C47.0608 10.9765 47.7008 11.7877 48.9808 11.7877C50.2608 11.7877 50.9008 10.9765 50.9008 9.36164C50.9008 7.74676 50.2608 6.93559 48.9808 6.93559C47.6933 6.93559 47.0608 7.76908 47.0608 9.36164Z" fill="#1F2937"></path><path d="M52.583 9.3839C52.583 7.25553 53.476 6.31786 55.2472 6.31786C55.6491 6.31786 56.0137 6.39972 56.3337 6.57088C56.6537 6.74204 56.9067 6.93553 57.0556 7.18855V3.84716C57.0556 3.72065 57.1002 3.63135 57.1821 3.54949C57.2639 3.46762 57.3532 3.42297 57.4798 3.42297C57.6063 3.42297 57.6956 3.46762 57.7774 3.54949C57.8593 3.63135 57.9039 3.72065 57.9039 3.84716V9.95693C57.9039 10.8053 57.6658 11.4453 57.1821 11.8918C56.7132 12.3383 56.0732 12.569 55.2844 12.569C54.4137 12.569 53.7291 12.2937 53.2602 11.7579C52.8137 11.2369 52.583 10.4481 52.583 9.3839ZM53.4314 9.3839C53.4314 10.9988 54.0491 11.81 55.3067 11.81C55.8425 11.81 56.2667 11.6611 56.5867 11.3411C56.9067 11.0211 57.0556 10.5746 57.0556 9.95693V8.25274C57.0332 8.23042 57.0109 8.18576 56.9886 8.12623C56.9663 8.05925 56.9067 7.97739 56.7951 7.85088C56.6909 7.72437 56.5793 7.59786 56.4528 7.48623C56.3263 7.38204 56.1551 7.29274 55.9616 7.21088C55.7458 7.12902 55.5374 7.08437 55.2993 7.08437C54.6816 7.08437 54.2351 7.27786 53.8928 7.67972C53.5802 8.08158 53.4314 8.57274 53.4314 9.3839Z" fill="#1F2937"></path><path d="M58.9312 9.36193C58.9312 8.3424 59.1693 7.55356 59.653 7.00286C60.1367 6.45216 60.8065 6.16937 61.6772 6.16937C62.0195 6.16937 62.3395 6.21402 62.5925 6.29588C62.8679 6.37774 63.106 6.48937 63.2772 6.63821C63.4484 6.78705 63.6195 6.93588 63.746 7.12937C63.8725 7.30054 63.9842 7.49402 64.0437 7.7024C64.1107 7.91821 64.1479 8.08193 64.1925 8.25309C64.2372 8.42426 64.2372 8.59542 64.2372 8.76658C64.2372 8.89309 64.2372 8.99728 64.2372 9.06426C64.2372 9.13123 64.2149 9.21309 64.1702 9.31728C64.1479 9.42147 64.0884 9.48844 63.9991 9.53309C63.9172 9.57774 63.8279 9.60007 63.7014 9.60007H59.8316C59.8316 10.2624 60.0028 10.7908 60.3674 11.1777C60.7321 11.5573 61.2232 11.7731 61.8409 11.7731C62.1832 11.7731 62.4809 11.7284 62.7116 11.6243C62.9498 11.5201 63.2028 11.3936 63.4335 11.2001C63.5153 11.1331 63.6046 11.1182 63.6716 11.1182C63.7758 11.1182 63.8651 11.1629 63.947 11.2224C64.0139 11.3043 64.0512 11.3936 64.0512 11.4977C64.0512 11.6019 64.0065 11.7136 63.9023 11.7954C63.8205 11.8773 63.6865 11.9889 63.5377 12.0931C63.3888 12.1973 63.1507 12.2866 62.8307 12.3908C62.5107 12.495 62.1684 12.5396 61.8037 12.5396C60.8884 12.5396 60.1814 12.2866 59.6902 11.7508C59.1916 11.2522 58.9312 10.4484 58.9312 9.36193ZM59.8093 8.87077H63.3888C63.3888 8.61774 63.3665 8.37961 63.307 8.17123C63.2623 7.95542 63.1805 7.76937 63.0539 7.57588C62.9274 7.3824 62.7563 7.23356 62.5181 7.12937C62.28 7.02519 62.0046 6.95821 61.6846 6.95821C61.1116 6.95821 60.68 7.12937 60.3377 7.4717C60.0251 7.80658 59.8316 8.27542 59.8093 8.87077Z" fill="#1F2937"></path><path d="M19.229 4.18977C19.229 3.97395 19.3109 3.78791 19.4671 3.63907C19.616 3.49023 19.8095 3.40837 20.0253 3.40837C20.2188 3.40837 20.3899 3.47535 20.5164 3.57954C20.643 3.68372 20.7323 3.81023 20.7695 3.94419L22.3248 9.51814L23.8355 3.96651C23.8802 3.79535 23.962 3.66884 24.1109 3.56465C24.2597 3.46047 24.4085 3.41581 24.5574 3.41581C24.7285 3.41581 24.8774 3.46047 25.0039 3.56465C25.1304 3.66884 25.242 3.79535 25.2792 3.96651L26.7899 9.51814L28.3453 3.92186C28.3899 3.79535 28.4718 3.66884 28.5983 3.55721C28.7248 3.45302 28.8737 3.38605 29.0895 3.38605C29.3053 3.38605 29.4764 3.45302 29.6253 3.60186C29.7741 3.7507 29.8411 3.92186 29.8411 4.13023C29.8411 4.21209 29.8188 4.3014 29.7964 4.36093L27.5118 11.9591C27.4671 12.1079 27.3853 12.2567 27.2364 12.3386C27.1099 12.4428 26.9611 12.4874 26.7899 12.4874C26.6188 12.4874 26.4699 12.4428 26.3434 12.3386C26.2169 12.2344 26.1276 12.1079 26.0904 11.9367L24.5574 6.4893L23.0244 11.9963C22.9797 12.1674 22.8755 12.294 22.749 12.3981C22.6225 12.5023 22.4513 12.547 22.2802 12.547C22.109 12.547 21.9602 12.5023 21.8337 12.3981C21.7071 12.294 21.5955 12.1674 21.5583 12.0186L19.2737 4.42791C19.2513 4.36093 19.229 4.27907 19.229 4.18977Z" fill="#1F2937"></path><path d="M30.9351 11.8101V4.18967C30.9351 3.97386 31.0169 3.81014 31.1509 3.6613C31.2997 3.51246 31.4932 3.4306 31.709 3.4306H34.2467C35.0802 3.4306 35.7425 3.6613 36.2485 4.13014C36.762 4.59898 37.0374 5.27618 37.0374 6.15432C37.0374 7.04735 36.7844 7.70967 36.2709 8.17851C35.7574 8.64735 35.0802 8.87805 34.269 8.87805H32.4978V11.8176C32.4978 12.0334 32.4309 12.2194 32.282 12.3683C32.1332 12.5171 31.962 12.5841 31.7239 12.5841C31.4858 12.5841 31.322 12.5022 31.1732 12.3534C31.002 12.1897 30.9351 12.0185 30.9351 11.8101ZM32.4755 7.48642H34.1202C34.5444 7.48642 34.8644 7.35991 35.1025 7.12177C35.3406 6.89107 35.4448 6.54874 35.4448 6.12456C35.4448 5.70037 35.3406 5.35805 35.1025 5.12735C34.8644 4.89665 34.5444 4.78502 34.1425 4.78502H32.4978V7.48642H32.4755V7.48642Z" fill="#1F2937"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M14.3916 15.9999H1.64367C0.720884 15.9999 -0.000976562 15.278 -0.000976562 14.3627V1.63709C-0.000976562 0.721738 0.720884 -0.00012207 1.64367 -0.00012207H14.3916C15.3069 -0.00012207 16.0362 0.721738 16.0362 1.63709V14.3627C16.0362 15.278 15.3069 15.9999 14.3916 15.9999ZM3.96553 13.0231C3.88367 13.0231 3.77205 13.0008 3.69019 12.9785C3.30321 12.8296 3.11716 12.4055 3.266 12.0185L6.61484 3.44546C6.76367 3.06592 7.18786 2.87244 7.57484 3.02127C7.96181 3.17011 8.14786 3.5943 7.99902 3.98127L4.66507 12.5543C4.56088 12.852 4.26321 13.0231 3.96553 13.0231ZM8.76554 11.9366C8.91437 12.0855 9.10786 12.1524 9.30135 12.1524C9.49484 12.1524 9.68833 12.0855 9.83716 11.9366L12.4567 9.33941C12.9255 8.87058 12.9255 8.08174 12.4567 7.6129L9.83716 4.99337C9.56181 4.69569 9.09298 4.69569 8.7953 4.99337C8.49763 5.26872 8.49763 5.73755 8.7953 6.03523L11.2065 8.46127L8.77298 10.8873C8.46042 11.1701 8.46042 11.6389 8.76554 11.9366Z" fill="#1F2937"></path></svg>
			<a href="https://library.wpcode.com/use-snippet/" >1-click Use in WordPress</a>
		</div>
		</div></div>


<p>Don&#8217;t forget to replace <code>key</code> with your custom field name.</p>



<h4 class="wp-block-heading" id="customsidebar">Display a Custom Header, Footer, Sidebar Using Custom Fields</h4>



<p>Usually, most WordPress themes use the same header, footer, and sidebar on all pages. </p>



<p>There are also many ways to show different sidebars, headers, or footers for different pages on your website. You can see our guide on how to <a href="https://www.wpbeginner.com/wp-themes/display-different-sidebar-for-each-post-and-page-for-wordpress/" title="How to Display Different Sidebar for Each Post and Page in WordPress">display a different sidebar for each WordPress post or page</a>.</p>



<p>One way to do this is by using custom fields. Just edit the post or page where you want to show a different sidebar and then add the sidebar as a custom field.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="680" height="260" src="https://www.wpbeginner.com/wp-content/uploads/2020/04/add-sidebar-custom-field.png" alt="Add sidebar custom field" class="wp-image-192538" title="Adding custom sidebar to a post using custom field" srcset="https://www.wpbeginner.com/wp-content/uploads/2020/04/add-sidebar-custom-field.png 680w, https://www.wpbeginner.com/wp-content/uploads/2020/04/add-sidebar-custom-field-300x115.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<p>Now you need to edit your WordPress theme file, such as single.php, where you want to display a custom sidebar. You will be looking for the following code:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: php; title: ; notranslate">
&lt;?php get_sidebar(); ?&gt;
</pre><div class="wpcode-syntax-footer">
		<div class="wpcode-syntax-code-footer-left">Hosted with ❤️ by <strong><a href="https://wpcode.com/" >WPCode</a></strong></div>
		<div class="wpcode-syntax-code-footer-right">
			<svg width="65" height="16" viewBox="0 0 65 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M38.0415 7.99972C38.0415 6.44437 38.4062 5.38018 39.128 4.59879C39.8499 3.80995 40.8769 3.42297 42.1941 3.42297C42.8117 3.42297 43.4071 3.54949 43.9206 3.80251C44.4564 4.05553 44.8582 4.39786 45.1782 4.82204C45.2452 4.9039 45.2601 4.99321 45.2601 5.09739C45.2601 5.2239 45.2155 5.31321 45.1336 5.39507C45.0517 5.47693 44.9624 5.52158 44.8359 5.52158C44.6871 5.52158 44.5829 5.4546 44.4936 5.35042C44.2555 5.03042 43.9429 4.75507 43.5113 4.53925C43.1094 4.32344 42.6555 4.21925 42.1643 4.21925C41.1224 4.21925 40.3336 4.53925 39.7755 5.17925C39.2248 5.81925 38.942 6.68995 38.942 7.96995C38.942 9.30948 39.2173 10.2025 39.7531 10.7979C40.2889 11.3932 41.0927 11.7132 42.1643 11.7132C42.6331 11.7132 43.0573 11.6313 43.4889 11.4379C43.8908 11.2444 44.2331 10.9913 44.4936 10.6267C44.5755 10.5225 44.6871 10.4555 44.8359 10.4555C44.9624 10.4555 45.0517 10.5002 45.1336 10.582C45.2155 10.6639 45.2601 10.7755 45.2601 10.8797C45.2601 10.9616 45.2378 11.0509 45.1782 11.1327C44.8806 11.5569 44.4713 11.8993 43.9206 12.1523C43.3699 12.4053 42.7894 12.5318 42.1717 12.5318C40.8322 12.5318 39.8052 12.1523 39.0982 11.4006C38.3987 10.6788 38.0415 9.59228 38.0415 7.99972Z" fill="#1F2937"></path><path d="M46.9268 11.7654C46.4356 11.237 46.1826 10.4258 46.1826 9.36164C46.1826 8.29745 46.4208 7.50862 46.9045 6.98024C47.3956 6.45187 48.0803 6.19141 48.9733 6.19141C49.8663 6.19141 50.551 6.44443 51.0422 6.98024C51.5333 7.50862 51.764 8.29745 51.764 9.36164C51.764 10.4258 51.5259 11.237 51.0422 11.7654C50.551 12.2937 49.8663 12.5765 48.9733 12.5765C48.1026 12.5765 47.418 12.3012 46.9268 11.7654ZM47.0608 9.36164C47.0608 10.9765 47.7008 11.7877 48.9808 11.7877C50.2608 11.7877 50.9008 10.9765 50.9008 9.36164C50.9008 7.74676 50.2608 6.93559 48.9808 6.93559C47.6933 6.93559 47.0608 7.76908 47.0608 9.36164Z" fill="#1F2937"></path><path d="M52.583 9.3839C52.583 7.25553 53.476 6.31786 55.2472 6.31786C55.6491 6.31786 56.0137 6.39972 56.3337 6.57088C56.6537 6.74204 56.9067 6.93553 57.0556 7.18855V3.84716C57.0556 3.72065 57.1002 3.63135 57.1821 3.54949C57.2639 3.46762 57.3532 3.42297 57.4798 3.42297C57.6063 3.42297 57.6956 3.46762 57.7774 3.54949C57.8593 3.63135 57.9039 3.72065 57.9039 3.84716V9.95693C57.9039 10.8053 57.6658 11.4453 57.1821 11.8918C56.7132 12.3383 56.0732 12.569 55.2844 12.569C54.4137 12.569 53.7291 12.2937 53.2602 11.7579C52.8137 11.2369 52.583 10.4481 52.583 9.3839ZM53.4314 9.3839C53.4314 10.9988 54.0491 11.81 55.3067 11.81C55.8425 11.81 56.2667 11.6611 56.5867 11.3411C56.9067 11.0211 57.0556 10.5746 57.0556 9.95693V8.25274C57.0332 8.23042 57.0109 8.18576 56.9886 8.12623C56.9663 8.05925 56.9067 7.97739 56.7951 7.85088C56.6909 7.72437 56.5793 7.59786 56.4528 7.48623C56.3263 7.38204 56.1551 7.29274 55.9616 7.21088C55.7458 7.12902 55.5374 7.08437 55.2993 7.08437C54.6816 7.08437 54.2351 7.27786 53.8928 7.67972C53.5802 8.08158 53.4314 8.57274 53.4314 9.3839Z" fill="#1F2937"></path><path d="M58.9312 9.36193C58.9312 8.3424 59.1693 7.55356 59.653 7.00286C60.1367 6.45216 60.8065 6.16937 61.6772 6.16937C62.0195 6.16937 62.3395 6.21402 62.5925 6.29588C62.8679 6.37774 63.106 6.48937 63.2772 6.63821C63.4484 6.78705 63.6195 6.93588 63.746 7.12937C63.8725 7.30054 63.9842 7.49402 64.0437 7.7024C64.1107 7.91821 64.1479 8.08193 64.1925 8.25309C64.2372 8.42426 64.2372 8.59542 64.2372 8.76658C64.2372 8.89309 64.2372 8.99728 64.2372 9.06426C64.2372 9.13123 64.2149 9.21309 64.1702 9.31728C64.1479 9.42147 64.0884 9.48844 63.9991 9.53309C63.9172 9.57774 63.8279 9.60007 63.7014 9.60007H59.8316C59.8316 10.2624 60.0028 10.7908 60.3674 11.1777C60.7321 11.5573 61.2232 11.7731 61.8409 11.7731C62.1832 11.7731 62.4809 11.7284 62.7116 11.6243C62.9498 11.5201 63.2028 11.3936 63.4335 11.2001C63.5153 11.1331 63.6046 11.1182 63.6716 11.1182C63.7758 11.1182 63.8651 11.1629 63.947 11.2224C64.0139 11.3043 64.0512 11.3936 64.0512 11.4977C64.0512 11.6019 64.0065 11.7136 63.9023 11.7954C63.8205 11.8773 63.6865 11.9889 63.5377 12.0931C63.3888 12.1973 63.1507 12.2866 62.8307 12.3908C62.5107 12.495 62.1684 12.5396 61.8037 12.5396C60.8884 12.5396 60.1814 12.2866 59.6902 11.7508C59.1916 11.2522 58.9312 10.4484 58.9312 9.36193ZM59.8093 8.87077H63.3888C63.3888 8.61774 63.3665 8.37961 63.307 8.17123C63.2623 7.95542 63.1805 7.76937 63.0539 7.57588C62.9274 7.3824 62.7563 7.23356 62.5181 7.12937C62.28 7.02519 62.0046 6.95821 61.6846 6.95821C61.1116 6.95821 60.68 7.12937 60.3377 7.4717C60.0251 7.80658 59.8316 8.27542 59.8093 8.87077Z" fill="#1F2937"></path><path d="M19.229 4.18977C19.229 3.97395 19.3109 3.78791 19.4671 3.63907C19.616 3.49023 19.8095 3.40837 20.0253 3.40837C20.2188 3.40837 20.3899 3.47535 20.5164 3.57954C20.643 3.68372 20.7323 3.81023 20.7695 3.94419L22.3248 9.51814L23.8355 3.96651C23.8802 3.79535 23.962 3.66884 24.1109 3.56465C24.2597 3.46047 24.4085 3.41581 24.5574 3.41581C24.7285 3.41581 24.8774 3.46047 25.0039 3.56465C25.1304 3.66884 25.242 3.79535 25.2792 3.96651L26.7899 9.51814L28.3453 3.92186C28.3899 3.79535 28.4718 3.66884 28.5983 3.55721C28.7248 3.45302 28.8737 3.38605 29.0895 3.38605C29.3053 3.38605 29.4764 3.45302 29.6253 3.60186C29.7741 3.7507 29.8411 3.92186 29.8411 4.13023C29.8411 4.21209 29.8188 4.3014 29.7964 4.36093L27.5118 11.9591C27.4671 12.1079 27.3853 12.2567 27.2364 12.3386C27.1099 12.4428 26.9611 12.4874 26.7899 12.4874C26.6188 12.4874 26.4699 12.4428 26.3434 12.3386C26.2169 12.2344 26.1276 12.1079 26.0904 11.9367L24.5574 6.4893L23.0244 11.9963C22.9797 12.1674 22.8755 12.294 22.749 12.3981C22.6225 12.5023 22.4513 12.547 22.2802 12.547C22.109 12.547 21.9602 12.5023 21.8337 12.3981C21.7071 12.294 21.5955 12.1674 21.5583 12.0186L19.2737 4.42791C19.2513 4.36093 19.229 4.27907 19.229 4.18977Z" fill="#1F2937"></path><path d="M30.9351 11.8101V4.18967C30.9351 3.97386 31.0169 3.81014 31.1509 3.6613C31.2997 3.51246 31.4932 3.4306 31.709 3.4306H34.2467C35.0802 3.4306 35.7425 3.6613 36.2485 4.13014C36.762 4.59898 37.0374 5.27618 37.0374 6.15432C37.0374 7.04735 36.7844 7.70967 36.2709 8.17851C35.7574 8.64735 35.0802 8.87805 34.269 8.87805H32.4978V11.8176C32.4978 12.0334 32.4309 12.2194 32.282 12.3683C32.1332 12.5171 31.962 12.5841 31.7239 12.5841C31.4858 12.5841 31.322 12.5022 31.1732 12.3534C31.002 12.1897 30.9351 12.0185 30.9351 11.8101ZM32.4755 7.48642H34.1202C34.5444 7.48642 34.8644 7.35991 35.1025 7.12177C35.3406 6.89107 35.4448 6.54874 35.4448 6.12456C35.4448 5.70037 35.3406 5.35805 35.1025 5.12735C34.8644 4.89665 34.5444 4.78502 34.1425 4.78502H32.4978V7.48642H32.4755V7.48642Z" fill="#1F2937"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M14.3916 15.9999H1.64367C0.720884 15.9999 -0.000976562 15.278 -0.000976562 14.3627V1.63709C-0.000976562 0.721738 0.720884 -0.00012207 1.64367 -0.00012207H14.3916C15.3069 -0.00012207 16.0362 0.721738 16.0362 1.63709V14.3627C16.0362 15.278 15.3069 15.9999 14.3916 15.9999ZM3.96553 13.0231C3.88367 13.0231 3.77205 13.0008 3.69019 12.9785C3.30321 12.8296 3.11716 12.4055 3.266 12.0185L6.61484 3.44546C6.76367 3.06592 7.18786 2.87244 7.57484 3.02127C7.96181 3.17011 8.14786 3.5943 7.99902 3.98127L4.66507 12.5543C4.56088 12.852 4.26321 13.0231 3.96553 13.0231ZM8.76554 11.9366C8.91437 12.0855 9.10786 12.1524 9.30135 12.1524C9.49484 12.1524 9.68833 12.0855 9.83716 11.9366L12.4567 9.33941C12.9255 8.87058 12.9255 8.08174 12.4567 7.6129L9.83716 4.99337C9.56181 4.69569 9.09298 4.69569 8.7953 4.99337C8.49763 5.26872 8.49763 5.73755 8.7953 6.03523L11.2065 8.46127L8.77298 10.8873C8.46042 11.1701 8.46042 11.6389 8.76554 11.9366Z" fill="#1F2937"></path></svg>
			<a href="https://library.wpcode.com/use-snippet/" >1-click Use in WordPress</a>
		</div>
		</div></div>


<p>Replace this line with the following code:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: php; title: ; notranslate">
&lt;?php
global $wp_query;
$postid = $wp_query-&gt;post-&gt;ID;
$sidebar = get_post_meta($postid, &quot;sidebar&quot;, true);
get_sidebar($sidebar);
wp_reset_query();
?&gt;
</pre><div class="wpcode-syntax-footer">
		<div class="wpcode-syntax-code-footer-left">Hosted with ❤️ by <strong><a href="https://wpcode.com/" >WPCode</a></strong></div>
		<div class="wpcode-syntax-code-footer-right">
			<svg width="65" height="16" viewBox="0 0 65 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M38.0415 7.99972C38.0415 6.44437 38.4062 5.38018 39.128 4.59879C39.8499 3.80995 40.8769 3.42297 42.1941 3.42297C42.8117 3.42297 43.4071 3.54949 43.9206 3.80251C44.4564 4.05553 44.8582 4.39786 45.1782 4.82204C45.2452 4.9039 45.2601 4.99321 45.2601 5.09739C45.2601 5.2239 45.2155 5.31321 45.1336 5.39507C45.0517 5.47693 44.9624 5.52158 44.8359 5.52158C44.6871 5.52158 44.5829 5.4546 44.4936 5.35042C44.2555 5.03042 43.9429 4.75507 43.5113 4.53925C43.1094 4.32344 42.6555 4.21925 42.1643 4.21925C41.1224 4.21925 40.3336 4.53925 39.7755 5.17925C39.2248 5.81925 38.942 6.68995 38.942 7.96995C38.942 9.30948 39.2173 10.2025 39.7531 10.7979C40.2889 11.3932 41.0927 11.7132 42.1643 11.7132C42.6331 11.7132 43.0573 11.6313 43.4889 11.4379C43.8908 11.2444 44.2331 10.9913 44.4936 10.6267C44.5755 10.5225 44.6871 10.4555 44.8359 10.4555C44.9624 10.4555 45.0517 10.5002 45.1336 10.582C45.2155 10.6639 45.2601 10.7755 45.2601 10.8797C45.2601 10.9616 45.2378 11.0509 45.1782 11.1327C44.8806 11.5569 44.4713 11.8993 43.9206 12.1523C43.3699 12.4053 42.7894 12.5318 42.1717 12.5318C40.8322 12.5318 39.8052 12.1523 39.0982 11.4006C38.3987 10.6788 38.0415 9.59228 38.0415 7.99972Z" fill="#1F2937"></path><path d="M46.9268 11.7654C46.4356 11.237 46.1826 10.4258 46.1826 9.36164C46.1826 8.29745 46.4208 7.50862 46.9045 6.98024C47.3956 6.45187 48.0803 6.19141 48.9733 6.19141C49.8663 6.19141 50.551 6.44443 51.0422 6.98024C51.5333 7.50862 51.764 8.29745 51.764 9.36164C51.764 10.4258 51.5259 11.237 51.0422 11.7654C50.551 12.2937 49.8663 12.5765 48.9733 12.5765C48.1026 12.5765 47.418 12.3012 46.9268 11.7654ZM47.0608 9.36164C47.0608 10.9765 47.7008 11.7877 48.9808 11.7877C50.2608 11.7877 50.9008 10.9765 50.9008 9.36164C50.9008 7.74676 50.2608 6.93559 48.9808 6.93559C47.6933 6.93559 47.0608 7.76908 47.0608 9.36164Z" fill="#1F2937"></path><path d="M52.583 9.3839C52.583 7.25553 53.476 6.31786 55.2472 6.31786C55.6491 6.31786 56.0137 6.39972 56.3337 6.57088C56.6537 6.74204 56.9067 6.93553 57.0556 7.18855V3.84716C57.0556 3.72065 57.1002 3.63135 57.1821 3.54949C57.2639 3.46762 57.3532 3.42297 57.4798 3.42297C57.6063 3.42297 57.6956 3.46762 57.7774 3.54949C57.8593 3.63135 57.9039 3.72065 57.9039 3.84716V9.95693C57.9039 10.8053 57.6658 11.4453 57.1821 11.8918C56.7132 12.3383 56.0732 12.569 55.2844 12.569C54.4137 12.569 53.7291 12.2937 53.2602 11.7579C52.8137 11.2369 52.583 10.4481 52.583 9.3839ZM53.4314 9.3839C53.4314 10.9988 54.0491 11.81 55.3067 11.81C55.8425 11.81 56.2667 11.6611 56.5867 11.3411C56.9067 11.0211 57.0556 10.5746 57.0556 9.95693V8.25274C57.0332 8.23042 57.0109 8.18576 56.9886 8.12623C56.9663 8.05925 56.9067 7.97739 56.7951 7.85088C56.6909 7.72437 56.5793 7.59786 56.4528 7.48623C56.3263 7.38204 56.1551 7.29274 55.9616 7.21088C55.7458 7.12902 55.5374 7.08437 55.2993 7.08437C54.6816 7.08437 54.2351 7.27786 53.8928 7.67972C53.5802 8.08158 53.4314 8.57274 53.4314 9.3839Z" fill="#1F2937"></path><path d="M58.9312 9.36193C58.9312 8.3424 59.1693 7.55356 59.653 7.00286C60.1367 6.45216 60.8065 6.16937 61.6772 6.16937C62.0195 6.16937 62.3395 6.21402 62.5925 6.29588C62.8679 6.37774 63.106 6.48937 63.2772 6.63821C63.4484 6.78705 63.6195 6.93588 63.746 7.12937C63.8725 7.30054 63.9842 7.49402 64.0437 7.7024C64.1107 7.91821 64.1479 8.08193 64.1925 8.25309C64.2372 8.42426 64.2372 8.59542 64.2372 8.76658C64.2372 8.89309 64.2372 8.99728 64.2372 9.06426C64.2372 9.13123 64.2149 9.21309 64.1702 9.31728C64.1479 9.42147 64.0884 9.48844 63.9991 9.53309C63.9172 9.57774 63.8279 9.60007 63.7014 9.60007H59.8316C59.8316 10.2624 60.0028 10.7908 60.3674 11.1777C60.7321 11.5573 61.2232 11.7731 61.8409 11.7731C62.1832 11.7731 62.4809 11.7284 62.7116 11.6243C62.9498 11.5201 63.2028 11.3936 63.4335 11.2001C63.5153 11.1331 63.6046 11.1182 63.6716 11.1182C63.7758 11.1182 63.8651 11.1629 63.947 11.2224C64.0139 11.3043 64.0512 11.3936 64.0512 11.4977C64.0512 11.6019 64.0065 11.7136 63.9023 11.7954C63.8205 11.8773 63.6865 11.9889 63.5377 12.0931C63.3888 12.1973 63.1507 12.2866 62.8307 12.3908C62.5107 12.495 62.1684 12.5396 61.8037 12.5396C60.8884 12.5396 60.1814 12.2866 59.6902 11.7508C59.1916 11.2522 58.9312 10.4484 58.9312 9.36193ZM59.8093 8.87077H63.3888C63.3888 8.61774 63.3665 8.37961 63.307 8.17123C63.2623 7.95542 63.1805 7.76937 63.0539 7.57588C62.9274 7.3824 62.7563 7.23356 62.5181 7.12937C62.28 7.02519 62.0046 6.95821 61.6846 6.95821C61.1116 6.95821 60.68 7.12937 60.3377 7.4717C60.0251 7.80658 59.8316 8.27542 59.8093 8.87077Z" fill="#1F2937"></path><path d="M19.229 4.18977C19.229 3.97395 19.3109 3.78791 19.4671 3.63907C19.616 3.49023 19.8095 3.40837 20.0253 3.40837C20.2188 3.40837 20.3899 3.47535 20.5164 3.57954C20.643 3.68372 20.7323 3.81023 20.7695 3.94419L22.3248 9.51814L23.8355 3.96651C23.8802 3.79535 23.962 3.66884 24.1109 3.56465C24.2597 3.46047 24.4085 3.41581 24.5574 3.41581C24.7285 3.41581 24.8774 3.46047 25.0039 3.56465C25.1304 3.66884 25.242 3.79535 25.2792 3.96651L26.7899 9.51814L28.3453 3.92186C28.3899 3.79535 28.4718 3.66884 28.5983 3.55721C28.7248 3.45302 28.8737 3.38605 29.0895 3.38605C29.3053 3.38605 29.4764 3.45302 29.6253 3.60186C29.7741 3.7507 29.8411 3.92186 29.8411 4.13023C29.8411 4.21209 29.8188 4.3014 29.7964 4.36093L27.5118 11.9591C27.4671 12.1079 27.3853 12.2567 27.2364 12.3386C27.1099 12.4428 26.9611 12.4874 26.7899 12.4874C26.6188 12.4874 26.4699 12.4428 26.3434 12.3386C26.2169 12.2344 26.1276 12.1079 26.0904 11.9367L24.5574 6.4893L23.0244 11.9963C22.9797 12.1674 22.8755 12.294 22.749 12.3981C22.6225 12.5023 22.4513 12.547 22.2802 12.547C22.109 12.547 21.9602 12.5023 21.8337 12.3981C21.7071 12.294 21.5955 12.1674 21.5583 12.0186L19.2737 4.42791C19.2513 4.36093 19.229 4.27907 19.229 4.18977Z" fill="#1F2937"></path><path d="M30.9351 11.8101V4.18967C30.9351 3.97386 31.0169 3.81014 31.1509 3.6613C31.2997 3.51246 31.4932 3.4306 31.709 3.4306H34.2467C35.0802 3.4306 35.7425 3.6613 36.2485 4.13014C36.762 4.59898 37.0374 5.27618 37.0374 6.15432C37.0374 7.04735 36.7844 7.70967 36.2709 8.17851C35.7574 8.64735 35.0802 8.87805 34.269 8.87805H32.4978V11.8176C32.4978 12.0334 32.4309 12.2194 32.282 12.3683C32.1332 12.5171 31.962 12.5841 31.7239 12.5841C31.4858 12.5841 31.322 12.5022 31.1732 12.3534C31.002 12.1897 30.9351 12.0185 30.9351 11.8101ZM32.4755 7.48642H34.1202C34.5444 7.48642 34.8644 7.35991 35.1025 7.12177C35.3406 6.89107 35.4448 6.54874 35.4448 6.12456C35.4448 5.70037 35.3406 5.35805 35.1025 5.12735C34.8644 4.89665 34.5444 4.78502 34.1425 4.78502H32.4978V7.48642H32.4755V7.48642Z" fill="#1F2937"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M14.3916 15.9999H1.64367C0.720884 15.9999 -0.000976562 15.278 -0.000976562 14.3627V1.63709C-0.000976562 0.721738 0.720884 -0.00012207 1.64367 -0.00012207H14.3916C15.3069 -0.00012207 16.0362 0.721738 16.0362 1.63709V14.3627C16.0362 15.278 15.3069 15.9999 14.3916 15.9999ZM3.96553 13.0231C3.88367 13.0231 3.77205 13.0008 3.69019 12.9785C3.30321 12.8296 3.11716 12.4055 3.266 12.0185L6.61484 3.44546C6.76367 3.06592 7.18786 2.87244 7.57484 3.02127C7.96181 3.17011 8.14786 3.5943 7.99902 3.98127L4.66507 12.5543C4.56088 12.852 4.26321 13.0231 3.96553 13.0231ZM8.76554 11.9366C8.91437 12.0855 9.10786 12.1524 9.30135 12.1524C9.49484 12.1524 9.68833 12.0855 9.83716 11.9366L12.4567 9.33941C12.9255 8.87058 12.9255 8.08174 12.4567 7.6129L9.83716 4.99337C9.56181 4.69569 9.09298 4.69569 8.7953 4.99337C8.49763 5.26872 8.49763 5.73755 8.7953 6.03523L11.2065 8.46127L8.77298 10.8873C8.46042 11.1701 8.46042 11.6389 8.76554 11.9366Z" fill="#1F2937"></path></svg>
			<a href="https://library.wpcode.com/use-snippet/" >1-click Use in WordPress</a>
		</div>
		</div></div>


<p>This code simply looks for the sidebar custom field and then displays it in your theme. For example, if you add <code>webpage</code> as your sidebar custom field, then the code will look for a sidebar-webpage.php file to display.</p>



<p>You will need to create the sidebar-webpage.php file in your theme folder. You can copy the code from your theme&#8217;s sidebar.php file as a starting point.</p>



<h4 class="wp-block-heading" id="feedcontent">Manipulating RSS feed Content With Custom Fields</h4>



<p>Want to display additional metadata or content to your RSS feed users? Using custom fields you can manipulate your <a href="https://www.wpbeginner.com/wp-tutorials/how-to-optimize-your-wordpress-rss-feed/" title="Tips to Optimize Your WordPress RSS Feed (Quick &amp; Easy)">WordPress RSS feed</a> and add custom content into your feeds.</p>



<p>First, you need to add the following code to your theme&#8217;s functions.php file or use <a href="https://wpcode.com/"  rel="noopener" title="WPCode - WordPress Code Snippet Plugin">WPCode</a> (recommended): </p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: php; title: ; notranslate">
function wpbeginner_postrss($content) {
global $wp_query;
$postid = $wp_query-&gt;post-&gt;ID;
$coolcustom = get_post_meta($postid, 'coolcustom', true);
if(is_feed()) {
if($coolcustom !== '') {
$content = $content.&quot;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&quot;.$coolcustom.&quot;&lt;/div&gt;
&quot;;
}
else {
$content = $content;
}
}
return $content;
}
add_filter('the_excerpt_rss', 'wpbeginner_postrss');
add_filter('the_content', 'wpbeginner_postrss');
</pre><div class="wpcode-syntax-footer">
		<div class="wpcode-syntax-code-footer-left">Hosted with ❤️ by <strong><a href="https://wpcode.com/" >WPCode</a></strong></div>
		<div class="wpcode-syntax-code-footer-right">
			<svg width="65" height="16" viewBox="0 0 65 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M38.0415 7.99972C38.0415 6.44437 38.4062 5.38018 39.128 4.59879C39.8499 3.80995 40.8769 3.42297 42.1941 3.42297C42.8117 3.42297 43.4071 3.54949 43.9206 3.80251C44.4564 4.05553 44.8582 4.39786 45.1782 4.82204C45.2452 4.9039 45.2601 4.99321 45.2601 5.09739C45.2601 5.2239 45.2155 5.31321 45.1336 5.39507C45.0517 5.47693 44.9624 5.52158 44.8359 5.52158C44.6871 5.52158 44.5829 5.4546 44.4936 5.35042C44.2555 5.03042 43.9429 4.75507 43.5113 4.53925C43.1094 4.32344 42.6555 4.21925 42.1643 4.21925C41.1224 4.21925 40.3336 4.53925 39.7755 5.17925C39.2248 5.81925 38.942 6.68995 38.942 7.96995C38.942 9.30948 39.2173 10.2025 39.7531 10.7979C40.2889 11.3932 41.0927 11.7132 42.1643 11.7132C42.6331 11.7132 43.0573 11.6313 43.4889 11.4379C43.8908 11.2444 44.2331 10.9913 44.4936 10.6267C44.5755 10.5225 44.6871 10.4555 44.8359 10.4555C44.9624 10.4555 45.0517 10.5002 45.1336 10.582C45.2155 10.6639 45.2601 10.7755 45.2601 10.8797C45.2601 10.9616 45.2378 11.0509 45.1782 11.1327C44.8806 11.5569 44.4713 11.8993 43.9206 12.1523C43.3699 12.4053 42.7894 12.5318 42.1717 12.5318C40.8322 12.5318 39.8052 12.1523 39.0982 11.4006C38.3987 10.6788 38.0415 9.59228 38.0415 7.99972Z" fill="#1F2937"></path><path d="M46.9268 11.7654C46.4356 11.237 46.1826 10.4258 46.1826 9.36164C46.1826 8.29745 46.4208 7.50862 46.9045 6.98024C47.3956 6.45187 48.0803 6.19141 48.9733 6.19141C49.8663 6.19141 50.551 6.44443 51.0422 6.98024C51.5333 7.50862 51.764 8.29745 51.764 9.36164C51.764 10.4258 51.5259 11.237 51.0422 11.7654C50.551 12.2937 49.8663 12.5765 48.9733 12.5765C48.1026 12.5765 47.418 12.3012 46.9268 11.7654ZM47.0608 9.36164C47.0608 10.9765 47.7008 11.7877 48.9808 11.7877C50.2608 11.7877 50.9008 10.9765 50.9008 9.36164C50.9008 7.74676 50.2608 6.93559 48.9808 6.93559C47.6933 6.93559 47.0608 7.76908 47.0608 9.36164Z" fill="#1F2937"></path><path d="M52.583 9.3839C52.583 7.25553 53.476 6.31786 55.2472 6.31786C55.6491 6.31786 56.0137 6.39972 56.3337 6.57088C56.6537 6.74204 56.9067 6.93553 57.0556 7.18855V3.84716C57.0556 3.72065 57.1002 3.63135 57.1821 3.54949C57.2639 3.46762 57.3532 3.42297 57.4798 3.42297C57.6063 3.42297 57.6956 3.46762 57.7774 3.54949C57.8593 3.63135 57.9039 3.72065 57.9039 3.84716V9.95693C57.9039 10.8053 57.6658 11.4453 57.1821 11.8918C56.7132 12.3383 56.0732 12.569 55.2844 12.569C54.4137 12.569 53.7291 12.2937 53.2602 11.7579C52.8137 11.2369 52.583 10.4481 52.583 9.3839ZM53.4314 9.3839C53.4314 10.9988 54.0491 11.81 55.3067 11.81C55.8425 11.81 56.2667 11.6611 56.5867 11.3411C56.9067 11.0211 57.0556 10.5746 57.0556 9.95693V8.25274C57.0332 8.23042 57.0109 8.18576 56.9886 8.12623C56.9663 8.05925 56.9067 7.97739 56.7951 7.85088C56.6909 7.72437 56.5793 7.59786 56.4528 7.48623C56.3263 7.38204 56.1551 7.29274 55.9616 7.21088C55.7458 7.12902 55.5374 7.08437 55.2993 7.08437C54.6816 7.08437 54.2351 7.27786 53.8928 7.67972C53.5802 8.08158 53.4314 8.57274 53.4314 9.3839Z" fill="#1F2937"></path><path d="M58.9312 9.36193C58.9312 8.3424 59.1693 7.55356 59.653 7.00286C60.1367 6.45216 60.8065 6.16937 61.6772 6.16937C62.0195 6.16937 62.3395 6.21402 62.5925 6.29588C62.8679 6.37774 63.106 6.48937 63.2772 6.63821C63.4484 6.78705 63.6195 6.93588 63.746 7.12937C63.8725 7.30054 63.9842 7.49402 64.0437 7.7024C64.1107 7.91821 64.1479 8.08193 64.1925 8.25309C64.2372 8.42426 64.2372 8.59542 64.2372 8.76658C64.2372 8.89309 64.2372 8.99728 64.2372 9.06426C64.2372 9.13123 64.2149 9.21309 64.1702 9.31728C64.1479 9.42147 64.0884 9.48844 63.9991 9.53309C63.9172 9.57774 63.8279 9.60007 63.7014 9.60007H59.8316C59.8316 10.2624 60.0028 10.7908 60.3674 11.1777C60.7321 11.5573 61.2232 11.7731 61.8409 11.7731C62.1832 11.7731 62.4809 11.7284 62.7116 11.6243C62.9498 11.5201 63.2028 11.3936 63.4335 11.2001C63.5153 11.1331 63.6046 11.1182 63.6716 11.1182C63.7758 11.1182 63.8651 11.1629 63.947 11.2224C64.0139 11.3043 64.0512 11.3936 64.0512 11.4977C64.0512 11.6019 64.0065 11.7136 63.9023 11.7954C63.8205 11.8773 63.6865 11.9889 63.5377 12.0931C63.3888 12.1973 63.1507 12.2866 62.8307 12.3908C62.5107 12.495 62.1684 12.5396 61.8037 12.5396C60.8884 12.5396 60.1814 12.2866 59.6902 11.7508C59.1916 11.2522 58.9312 10.4484 58.9312 9.36193ZM59.8093 8.87077H63.3888C63.3888 8.61774 63.3665 8.37961 63.307 8.17123C63.2623 7.95542 63.1805 7.76937 63.0539 7.57588C62.9274 7.3824 62.7563 7.23356 62.5181 7.12937C62.28 7.02519 62.0046 6.95821 61.6846 6.95821C61.1116 6.95821 60.68 7.12937 60.3377 7.4717C60.0251 7.80658 59.8316 8.27542 59.8093 8.87077Z" fill="#1F2937"></path><path d="M19.229 4.18977C19.229 3.97395 19.3109 3.78791 19.4671 3.63907C19.616 3.49023 19.8095 3.40837 20.0253 3.40837C20.2188 3.40837 20.3899 3.47535 20.5164 3.57954C20.643 3.68372 20.7323 3.81023 20.7695 3.94419L22.3248 9.51814L23.8355 3.96651C23.8802 3.79535 23.962 3.66884 24.1109 3.56465C24.2597 3.46047 24.4085 3.41581 24.5574 3.41581C24.7285 3.41581 24.8774 3.46047 25.0039 3.56465C25.1304 3.66884 25.242 3.79535 25.2792 3.96651L26.7899 9.51814L28.3453 3.92186C28.3899 3.79535 28.4718 3.66884 28.5983 3.55721C28.7248 3.45302 28.8737 3.38605 29.0895 3.38605C29.3053 3.38605 29.4764 3.45302 29.6253 3.60186C29.7741 3.7507 29.8411 3.92186 29.8411 4.13023C29.8411 4.21209 29.8188 4.3014 29.7964 4.36093L27.5118 11.9591C27.4671 12.1079 27.3853 12.2567 27.2364 12.3386C27.1099 12.4428 26.9611 12.4874 26.7899 12.4874C26.6188 12.4874 26.4699 12.4428 26.3434 12.3386C26.2169 12.2344 26.1276 12.1079 26.0904 11.9367L24.5574 6.4893L23.0244 11.9963C22.9797 12.1674 22.8755 12.294 22.749 12.3981C22.6225 12.5023 22.4513 12.547 22.2802 12.547C22.109 12.547 21.9602 12.5023 21.8337 12.3981C21.7071 12.294 21.5955 12.1674 21.5583 12.0186L19.2737 4.42791C19.2513 4.36093 19.229 4.27907 19.229 4.18977Z" fill="#1F2937"></path><path d="M30.9351 11.8101V4.18967C30.9351 3.97386 31.0169 3.81014 31.1509 3.6613C31.2997 3.51246 31.4932 3.4306 31.709 3.4306H34.2467C35.0802 3.4306 35.7425 3.6613 36.2485 4.13014C36.762 4.59898 37.0374 5.27618 37.0374 6.15432C37.0374 7.04735 36.7844 7.70967 36.2709 8.17851C35.7574 8.64735 35.0802 8.87805 34.269 8.87805H32.4978V11.8176C32.4978 12.0334 32.4309 12.2194 32.282 12.3683C32.1332 12.5171 31.962 12.5841 31.7239 12.5841C31.4858 12.5841 31.322 12.5022 31.1732 12.3534C31.002 12.1897 30.9351 12.0185 30.9351 11.8101ZM32.4755 7.48642H34.1202C34.5444 7.48642 34.8644 7.35991 35.1025 7.12177C35.3406 6.89107 35.4448 6.54874 35.4448 6.12456C35.4448 5.70037 35.3406 5.35805 35.1025 5.12735C34.8644 4.89665 34.5444 4.78502 34.1425 4.78502H32.4978V7.48642H32.4755V7.48642Z" fill="#1F2937"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M14.3916 15.9999H1.64367C0.720884 15.9999 -0.000976562 15.278 -0.000976562 14.3627V1.63709C-0.000976562 0.721738 0.720884 -0.00012207 1.64367 -0.00012207H14.3916C15.3069 -0.00012207 16.0362 0.721738 16.0362 1.63709V14.3627C16.0362 15.278 15.3069 15.9999 14.3916 15.9999ZM3.96553 13.0231C3.88367 13.0231 3.77205 13.0008 3.69019 12.9785C3.30321 12.8296 3.11716 12.4055 3.266 12.0185L6.61484 3.44546C6.76367 3.06592 7.18786 2.87244 7.57484 3.02127C7.96181 3.17011 8.14786 3.5943 7.99902 3.98127L4.66507 12.5543C4.56088 12.852 4.26321 13.0231 3.96553 13.0231ZM8.76554 11.9366C8.91437 12.0855 9.10786 12.1524 9.30135 12.1524C9.49484 12.1524 9.68833 12.0855 9.83716 11.9366L12.4567 9.33941C12.9255 8.87058 12.9255 8.08174 12.4567 7.6129L9.83716 4.99337C9.56181 4.69569 9.09298 4.69569 8.7953 4.99337C8.49763 5.26872 8.49763 5.73755 8.7953 6.03523L11.2065 8.46127L8.77298 10.8873C8.46042 11.1701 8.46042 11.6389 8.76554 11.9366Z" fill="#1F2937"></path></svg>
			<a href="https://library.wpcode.com/use-snippet/" >1-click Use in WordPress</a>
		</div>
		</div></div>


<p>Now, just create a custom field called &#8216;coolcustom&#8217; and add any value you like. You can use it to display advertisements, images, text, or anything you want.</p>



<p>For more details, please see our guide on <a href="https://www.wpbeginner.com/beginners-guide/beginners-guide-to-pasting-snippets-from-the-web-into-wordpress/" title="Beginner’s Guide to Pasting Snippets from the Web into WordPress">how to copy and paste code from the web into WordPress</a>.</p>



<h4 class="wp-block-heading" id="feedtitle">How to Manipulate RSS Feed Title With Custom Fields</h4>



<p>Sometimes you may want to add extra text to a post title for RSS feed users. For example, this can be handy if you are publishing a sponsored post or a guest post.</p>



<p>First, you need to add the following code to your theme&#8217;s functions.php file or use <a href="https://wpcode.com/"  rel="noopener" title="WPCode - WordPress Code Snippet Plugin">WPCode</a> to <a href="https://www.wpbeginner.com/plugins/how-to-easily-add-custom-code-in-wordpress-without-breaking-your-site/" title="How to Easily Add Custom Code in WordPress (Without Breaking Your Site)">add the custom code snippet</a> without breaking your website:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: php; title: ; notranslate">
function wpbeginner_titlerss($content) {
global $wp_query;
$postid = $wp_query-&gt;post-&gt;ID;
$gpost = get_post_meta($postid, 'guest_post', true);
$spost = get_post_meta($postid, 'sponsored_post', true);

if($gpost !== '') {
$content = 'Guest Post: '.$content;
}
elseif ($spost !== ''){
$content = 'Sponsored Post: '.$content;
}
else {
$content = $content;
}
return $content;
}
add_filter('the_title_rss', 'wpbeginner_titlerss');
</pre><div class="wpcode-syntax-footer">
		<div class="wpcode-syntax-code-footer-left">Hosted with ❤️ by <strong><a href="https://wpcode.com/" >WPCode</a></strong></div>
		<div class="wpcode-syntax-code-footer-right">
			<svg width="65" height="16" viewBox="0 0 65 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M38.0415 7.99972C38.0415 6.44437 38.4062 5.38018 39.128 4.59879C39.8499 3.80995 40.8769 3.42297 42.1941 3.42297C42.8117 3.42297 43.4071 3.54949 43.9206 3.80251C44.4564 4.05553 44.8582 4.39786 45.1782 4.82204C45.2452 4.9039 45.2601 4.99321 45.2601 5.09739C45.2601 5.2239 45.2155 5.31321 45.1336 5.39507C45.0517 5.47693 44.9624 5.52158 44.8359 5.52158C44.6871 5.52158 44.5829 5.4546 44.4936 5.35042C44.2555 5.03042 43.9429 4.75507 43.5113 4.53925C43.1094 4.32344 42.6555 4.21925 42.1643 4.21925C41.1224 4.21925 40.3336 4.53925 39.7755 5.17925C39.2248 5.81925 38.942 6.68995 38.942 7.96995C38.942 9.30948 39.2173 10.2025 39.7531 10.7979C40.2889 11.3932 41.0927 11.7132 42.1643 11.7132C42.6331 11.7132 43.0573 11.6313 43.4889 11.4379C43.8908 11.2444 44.2331 10.9913 44.4936 10.6267C44.5755 10.5225 44.6871 10.4555 44.8359 10.4555C44.9624 10.4555 45.0517 10.5002 45.1336 10.582C45.2155 10.6639 45.2601 10.7755 45.2601 10.8797C45.2601 10.9616 45.2378 11.0509 45.1782 11.1327C44.8806 11.5569 44.4713 11.8993 43.9206 12.1523C43.3699 12.4053 42.7894 12.5318 42.1717 12.5318C40.8322 12.5318 39.8052 12.1523 39.0982 11.4006C38.3987 10.6788 38.0415 9.59228 38.0415 7.99972Z" fill="#1F2937"></path><path d="M46.9268 11.7654C46.4356 11.237 46.1826 10.4258 46.1826 9.36164C46.1826 8.29745 46.4208 7.50862 46.9045 6.98024C47.3956 6.45187 48.0803 6.19141 48.9733 6.19141C49.8663 6.19141 50.551 6.44443 51.0422 6.98024C51.5333 7.50862 51.764 8.29745 51.764 9.36164C51.764 10.4258 51.5259 11.237 51.0422 11.7654C50.551 12.2937 49.8663 12.5765 48.9733 12.5765C48.1026 12.5765 47.418 12.3012 46.9268 11.7654ZM47.0608 9.36164C47.0608 10.9765 47.7008 11.7877 48.9808 11.7877C50.2608 11.7877 50.9008 10.9765 50.9008 9.36164C50.9008 7.74676 50.2608 6.93559 48.9808 6.93559C47.6933 6.93559 47.0608 7.76908 47.0608 9.36164Z" fill="#1F2937"></path><path d="M52.583 9.3839C52.583 7.25553 53.476 6.31786 55.2472 6.31786C55.6491 6.31786 56.0137 6.39972 56.3337 6.57088C56.6537 6.74204 56.9067 6.93553 57.0556 7.18855V3.84716C57.0556 3.72065 57.1002 3.63135 57.1821 3.54949C57.2639 3.46762 57.3532 3.42297 57.4798 3.42297C57.6063 3.42297 57.6956 3.46762 57.7774 3.54949C57.8593 3.63135 57.9039 3.72065 57.9039 3.84716V9.95693C57.9039 10.8053 57.6658 11.4453 57.1821 11.8918C56.7132 12.3383 56.0732 12.569 55.2844 12.569C54.4137 12.569 53.7291 12.2937 53.2602 11.7579C52.8137 11.2369 52.583 10.4481 52.583 9.3839ZM53.4314 9.3839C53.4314 10.9988 54.0491 11.81 55.3067 11.81C55.8425 11.81 56.2667 11.6611 56.5867 11.3411C56.9067 11.0211 57.0556 10.5746 57.0556 9.95693V8.25274C57.0332 8.23042 57.0109 8.18576 56.9886 8.12623C56.9663 8.05925 56.9067 7.97739 56.7951 7.85088C56.6909 7.72437 56.5793 7.59786 56.4528 7.48623C56.3263 7.38204 56.1551 7.29274 55.9616 7.21088C55.7458 7.12902 55.5374 7.08437 55.2993 7.08437C54.6816 7.08437 54.2351 7.27786 53.8928 7.67972C53.5802 8.08158 53.4314 8.57274 53.4314 9.3839Z" fill="#1F2937"></path><path d="M58.9312 9.36193C58.9312 8.3424 59.1693 7.55356 59.653 7.00286C60.1367 6.45216 60.8065 6.16937 61.6772 6.16937C62.0195 6.16937 62.3395 6.21402 62.5925 6.29588C62.8679 6.37774 63.106 6.48937 63.2772 6.63821C63.4484 6.78705 63.6195 6.93588 63.746 7.12937C63.8725 7.30054 63.9842 7.49402 64.0437 7.7024C64.1107 7.91821 64.1479 8.08193 64.1925 8.25309C64.2372 8.42426 64.2372 8.59542 64.2372 8.76658C64.2372 8.89309 64.2372 8.99728 64.2372 9.06426C64.2372 9.13123 64.2149 9.21309 64.1702 9.31728C64.1479 9.42147 64.0884 9.48844 63.9991 9.53309C63.9172 9.57774 63.8279 9.60007 63.7014 9.60007H59.8316C59.8316 10.2624 60.0028 10.7908 60.3674 11.1777C60.7321 11.5573 61.2232 11.7731 61.8409 11.7731C62.1832 11.7731 62.4809 11.7284 62.7116 11.6243C62.9498 11.5201 63.2028 11.3936 63.4335 11.2001C63.5153 11.1331 63.6046 11.1182 63.6716 11.1182C63.7758 11.1182 63.8651 11.1629 63.947 11.2224C64.0139 11.3043 64.0512 11.3936 64.0512 11.4977C64.0512 11.6019 64.0065 11.7136 63.9023 11.7954C63.8205 11.8773 63.6865 11.9889 63.5377 12.0931C63.3888 12.1973 63.1507 12.2866 62.8307 12.3908C62.5107 12.495 62.1684 12.5396 61.8037 12.5396C60.8884 12.5396 60.1814 12.2866 59.6902 11.7508C59.1916 11.2522 58.9312 10.4484 58.9312 9.36193ZM59.8093 8.87077H63.3888C63.3888 8.61774 63.3665 8.37961 63.307 8.17123C63.2623 7.95542 63.1805 7.76937 63.0539 7.57588C62.9274 7.3824 62.7563 7.23356 62.5181 7.12937C62.28 7.02519 62.0046 6.95821 61.6846 6.95821C61.1116 6.95821 60.68 7.12937 60.3377 7.4717C60.0251 7.80658 59.8316 8.27542 59.8093 8.87077Z" fill="#1F2937"></path><path d="M19.229 4.18977C19.229 3.97395 19.3109 3.78791 19.4671 3.63907C19.616 3.49023 19.8095 3.40837 20.0253 3.40837C20.2188 3.40837 20.3899 3.47535 20.5164 3.57954C20.643 3.68372 20.7323 3.81023 20.7695 3.94419L22.3248 9.51814L23.8355 3.96651C23.8802 3.79535 23.962 3.66884 24.1109 3.56465C24.2597 3.46047 24.4085 3.41581 24.5574 3.41581C24.7285 3.41581 24.8774 3.46047 25.0039 3.56465C25.1304 3.66884 25.242 3.79535 25.2792 3.96651L26.7899 9.51814L28.3453 3.92186C28.3899 3.79535 28.4718 3.66884 28.5983 3.55721C28.7248 3.45302 28.8737 3.38605 29.0895 3.38605C29.3053 3.38605 29.4764 3.45302 29.6253 3.60186C29.7741 3.7507 29.8411 3.92186 29.8411 4.13023C29.8411 4.21209 29.8188 4.3014 29.7964 4.36093L27.5118 11.9591C27.4671 12.1079 27.3853 12.2567 27.2364 12.3386C27.1099 12.4428 26.9611 12.4874 26.7899 12.4874C26.6188 12.4874 26.4699 12.4428 26.3434 12.3386C26.2169 12.2344 26.1276 12.1079 26.0904 11.9367L24.5574 6.4893L23.0244 11.9963C22.9797 12.1674 22.8755 12.294 22.749 12.3981C22.6225 12.5023 22.4513 12.547 22.2802 12.547C22.109 12.547 21.9602 12.5023 21.8337 12.3981C21.7071 12.294 21.5955 12.1674 21.5583 12.0186L19.2737 4.42791C19.2513 4.36093 19.229 4.27907 19.229 4.18977Z" fill="#1F2937"></path><path d="M30.9351 11.8101V4.18967C30.9351 3.97386 31.0169 3.81014 31.1509 3.6613C31.2997 3.51246 31.4932 3.4306 31.709 3.4306H34.2467C35.0802 3.4306 35.7425 3.6613 36.2485 4.13014C36.762 4.59898 37.0374 5.27618 37.0374 6.15432C37.0374 7.04735 36.7844 7.70967 36.2709 8.17851C35.7574 8.64735 35.0802 8.87805 34.269 8.87805H32.4978V11.8176C32.4978 12.0334 32.4309 12.2194 32.282 12.3683C32.1332 12.5171 31.962 12.5841 31.7239 12.5841C31.4858 12.5841 31.322 12.5022 31.1732 12.3534C31.002 12.1897 30.9351 12.0185 30.9351 11.8101ZM32.4755 7.48642H34.1202C34.5444 7.48642 34.8644 7.35991 35.1025 7.12177C35.3406 6.89107 35.4448 6.54874 35.4448 6.12456C35.4448 5.70037 35.3406 5.35805 35.1025 5.12735C34.8644 4.89665 34.5444 4.78502 34.1425 4.78502H32.4978V7.48642H32.4755V7.48642Z" fill="#1F2937"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M14.3916 15.9999H1.64367C0.720884 15.9999 -0.000976562 15.278 -0.000976562 14.3627V1.63709C-0.000976562 0.721738 0.720884 -0.00012207 1.64367 -0.00012207H14.3916C15.3069 -0.00012207 16.0362 0.721738 16.0362 1.63709V14.3627C16.0362 15.278 15.3069 15.9999 14.3916 15.9999ZM3.96553 13.0231C3.88367 13.0231 3.77205 13.0008 3.69019 12.9785C3.30321 12.8296 3.11716 12.4055 3.266 12.0185L6.61484 3.44546C6.76367 3.06592 7.18786 2.87244 7.57484 3.02127C7.96181 3.17011 8.14786 3.5943 7.99902 3.98127L4.66507 12.5543C4.56088 12.852 4.26321 13.0231 3.96553 13.0231ZM8.76554 11.9366C8.91437 12.0855 9.10786 12.1524 9.30135 12.1524C9.49484 12.1524 9.68833 12.0855 9.83716 11.9366L12.4567 9.33941C12.9255 8.87058 12.9255 8.08174 12.4567 7.6129L9.83716 4.99337C9.56181 4.69569 9.09298 4.69569 8.7953 4.99337C8.49763 5.26872 8.49763 5.73755 8.7953 6.03523L11.2065 8.46127L8.77298 10.8873C8.46042 11.1701 8.46042 11.6389 8.76554 11.9366Z" fill="#1F2937"></path></svg>
			<a href="https://library.wpcode.com/use-snippet/" >1-click Use in WordPress</a>
		</div>
		</div></div>


<p>Next, you need to edit the post where you want to display the extra text in the title field.</p>



<p>Then, add guest_post and sponsored_post as custom fields.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="680" height="243" src="https://www.wpbeginner.com/wp-content/uploads/2020/04/add-guest-post-custom-field.png" alt="Add guest post custom field" class="wp-image-196384" title="Sponsored and guest post custom fields" srcset="https://www.wpbeginner.com/wp-content/uploads/2020/04/add-guest-post-custom-field.png 680w, https://www.wpbeginner.com/wp-content/uploads/2020/04/add-guest-post-custom-field-300x107.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<p>If either of these two custom fields is found with a value &#8220;true&#8221;, then the code will add the appropriate text before the title. This technique can be used in many ways to fit whatever you like.</p>



<p>Want to learn more cool RSS feed hacks? See our guide on how to <a title="How to Add Content and Completely Manipulate Your WordPress RSS Feeds" href="https://www.wpbeginner.com/wp-tutorials/how-to-add-content-and-completely-manipulate-your-wordpress-rss-feeds/">add content and manipulate your WordPress RSS feeds</a>.</p>



<h4 class="wp-block-heading" id="expirepost">How to Set Expiration Date for Posts in WordPress Using Custom Fields</h4>



<p>Want to set an expiration date for some posts on your WordPress site? This comes in handy when you want to publish content only for a specific period like running surveys or limited-time offers.</p>



<p>One way to do this is by manually removing the post content or by using a plugin like <a href="https://www.wpbeginner.com/plugins/how-to-expire-posts-or-partial-post-content-in-wordpress/" title="Post Expirator">Post Expirator</a>.</p>



<p>Another option is using custom fields to automatically expire posts after a specific time. You will need to edit your theme files and modify the WordPress loop like this:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: php; title: ; notranslate">
&lt;?php
if (have_posts()) :
while (have_posts()) : the_post();
$expirationtime = get_post_meta($post-&gt;ID, &quot;expiration&quot;, false);
if( count( $expirationtime ) != '' ) {
if (is_array($expirationtime)) {
$expirestring = implode($expirationtime);
}

$secondsbetween = strtotime($expirestring)-time();
if ( $secondsbetween &gt;= 0 ) {
echo 'This post will expire on ' .$expirestring.'';
the_content();
} else {
echo &quot;Sorry this post expired!&quot;
}
} else {
the_content();
}
endwhile;
endif;
?&gt;
</pre><div class="wpcode-syntax-footer">
		<div class="wpcode-syntax-code-footer-left">Hosted with ❤️ by <strong><a href="https://wpcode.com/" >WPCode</a></strong></div>
		<div class="wpcode-syntax-code-footer-right">
			<svg width="65" height="16" viewBox="0 0 65 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M38.0415 7.99972C38.0415 6.44437 38.4062 5.38018 39.128 4.59879C39.8499 3.80995 40.8769 3.42297 42.1941 3.42297C42.8117 3.42297 43.4071 3.54949 43.9206 3.80251C44.4564 4.05553 44.8582 4.39786 45.1782 4.82204C45.2452 4.9039 45.2601 4.99321 45.2601 5.09739C45.2601 5.2239 45.2155 5.31321 45.1336 5.39507C45.0517 5.47693 44.9624 5.52158 44.8359 5.52158C44.6871 5.52158 44.5829 5.4546 44.4936 5.35042C44.2555 5.03042 43.9429 4.75507 43.5113 4.53925C43.1094 4.32344 42.6555 4.21925 42.1643 4.21925C41.1224 4.21925 40.3336 4.53925 39.7755 5.17925C39.2248 5.81925 38.942 6.68995 38.942 7.96995C38.942 9.30948 39.2173 10.2025 39.7531 10.7979C40.2889 11.3932 41.0927 11.7132 42.1643 11.7132C42.6331 11.7132 43.0573 11.6313 43.4889 11.4379C43.8908 11.2444 44.2331 10.9913 44.4936 10.6267C44.5755 10.5225 44.6871 10.4555 44.8359 10.4555C44.9624 10.4555 45.0517 10.5002 45.1336 10.582C45.2155 10.6639 45.2601 10.7755 45.2601 10.8797C45.2601 10.9616 45.2378 11.0509 45.1782 11.1327C44.8806 11.5569 44.4713 11.8993 43.9206 12.1523C43.3699 12.4053 42.7894 12.5318 42.1717 12.5318C40.8322 12.5318 39.8052 12.1523 39.0982 11.4006C38.3987 10.6788 38.0415 9.59228 38.0415 7.99972Z" fill="#1F2937"></path><path d="M46.9268 11.7654C46.4356 11.237 46.1826 10.4258 46.1826 9.36164C46.1826 8.29745 46.4208 7.50862 46.9045 6.98024C47.3956 6.45187 48.0803 6.19141 48.9733 6.19141C49.8663 6.19141 50.551 6.44443 51.0422 6.98024C51.5333 7.50862 51.764 8.29745 51.764 9.36164C51.764 10.4258 51.5259 11.237 51.0422 11.7654C50.551 12.2937 49.8663 12.5765 48.9733 12.5765C48.1026 12.5765 47.418 12.3012 46.9268 11.7654ZM47.0608 9.36164C47.0608 10.9765 47.7008 11.7877 48.9808 11.7877C50.2608 11.7877 50.9008 10.9765 50.9008 9.36164C50.9008 7.74676 50.2608 6.93559 48.9808 6.93559C47.6933 6.93559 47.0608 7.76908 47.0608 9.36164Z" fill="#1F2937"></path><path d="M52.583 9.3839C52.583 7.25553 53.476 6.31786 55.2472 6.31786C55.6491 6.31786 56.0137 6.39972 56.3337 6.57088C56.6537 6.74204 56.9067 6.93553 57.0556 7.18855V3.84716C57.0556 3.72065 57.1002 3.63135 57.1821 3.54949C57.2639 3.46762 57.3532 3.42297 57.4798 3.42297C57.6063 3.42297 57.6956 3.46762 57.7774 3.54949C57.8593 3.63135 57.9039 3.72065 57.9039 3.84716V9.95693C57.9039 10.8053 57.6658 11.4453 57.1821 11.8918C56.7132 12.3383 56.0732 12.569 55.2844 12.569C54.4137 12.569 53.7291 12.2937 53.2602 11.7579C52.8137 11.2369 52.583 10.4481 52.583 9.3839ZM53.4314 9.3839C53.4314 10.9988 54.0491 11.81 55.3067 11.81C55.8425 11.81 56.2667 11.6611 56.5867 11.3411C56.9067 11.0211 57.0556 10.5746 57.0556 9.95693V8.25274C57.0332 8.23042 57.0109 8.18576 56.9886 8.12623C56.9663 8.05925 56.9067 7.97739 56.7951 7.85088C56.6909 7.72437 56.5793 7.59786 56.4528 7.48623C56.3263 7.38204 56.1551 7.29274 55.9616 7.21088C55.7458 7.12902 55.5374 7.08437 55.2993 7.08437C54.6816 7.08437 54.2351 7.27786 53.8928 7.67972C53.5802 8.08158 53.4314 8.57274 53.4314 9.3839Z" fill="#1F2937"></path><path d="M58.9312 9.36193C58.9312 8.3424 59.1693 7.55356 59.653 7.00286C60.1367 6.45216 60.8065 6.16937 61.6772 6.16937C62.0195 6.16937 62.3395 6.21402 62.5925 6.29588C62.8679 6.37774 63.106 6.48937 63.2772 6.63821C63.4484 6.78705 63.6195 6.93588 63.746 7.12937C63.8725 7.30054 63.9842 7.49402 64.0437 7.7024C64.1107 7.91821 64.1479 8.08193 64.1925 8.25309C64.2372 8.42426 64.2372 8.59542 64.2372 8.76658C64.2372 8.89309 64.2372 8.99728 64.2372 9.06426C64.2372 9.13123 64.2149 9.21309 64.1702 9.31728C64.1479 9.42147 64.0884 9.48844 63.9991 9.53309C63.9172 9.57774 63.8279 9.60007 63.7014 9.60007H59.8316C59.8316 10.2624 60.0028 10.7908 60.3674 11.1777C60.7321 11.5573 61.2232 11.7731 61.8409 11.7731C62.1832 11.7731 62.4809 11.7284 62.7116 11.6243C62.9498 11.5201 63.2028 11.3936 63.4335 11.2001C63.5153 11.1331 63.6046 11.1182 63.6716 11.1182C63.7758 11.1182 63.8651 11.1629 63.947 11.2224C64.0139 11.3043 64.0512 11.3936 64.0512 11.4977C64.0512 11.6019 64.0065 11.7136 63.9023 11.7954C63.8205 11.8773 63.6865 11.9889 63.5377 12.0931C63.3888 12.1973 63.1507 12.2866 62.8307 12.3908C62.5107 12.495 62.1684 12.5396 61.8037 12.5396C60.8884 12.5396 60.1814 12.2866 59.6902 11.7508C59.1916 11.2522 58.9312 10.4484 58.9312 9.36193ZM59.8093 8.87077H63.3888C63.3888 8.61774 63.3665 8.37961 63.307 8.17123C63.2623 7.95542 63.1805 7.76937 63.0539 7.57588C62.9274 7.3824 62.7563 7.23356 62.5181 7.12937C62.28 7.02519 62.0046 6.95821 61.6846 6.95821C61.1116 6.95821 60.68 7.12937 60.3377 7.4717C60.0251 7.80658 59.8316 8.27542 59.8093 8.87077Z" fill="#1F2937"></path><path d="M19.229 4.18977C19.229 3.97395 19.3109 3.78791 19.4671 3.63907C19.616 3.49023 19.8095 3.40837 20.0253 3.40837C20.2188 3.40837 20.3899 3.47535 20.5164 3.57954C20.643 3.68372 20.7323 3.81023 20.7695 3.94419L22.3248 9.51814L23.8355 3.96651C23.8802 3.79535 23.962 3.66884 24.1109 3.56465C24.2597 3.46047 24.4085 3.41581 24.5574 3.41581C24.7285 3.41581 24.8774 3.46047 25.0039 3.56465C25.1304 3.66884 25.242 3.79535 25.2792 3.96651L26.7899 9.51814L28.3453 3.92186C28.3899 3.79535 28.4718 3.66884 28.5983 3.55721C28.7248 3.45302 28.8737 3.38605 29.0895 3.38605C29.3053 3.38605 29.4764 3.45302 29.6253 3.60186C29.7741 3.7507 29.8411 3.92186 29.8411 4.13023C29.8411 4.21209 29.8188 4.3014 29.7964 4.36093L27.5118 11.9591C27.4671 12.1079 27.3853 12.2567 27.2364 12.3386C27.1099 12.4428 26.9611 12.4874 26.7899 12.4874C26.6188 12.4874 26.4699 12.4428 26.3434 12.3386C26.2169 12.2344 26.1276 12.1079 26.0904 11.9367L24.5574 6.4893L23.0244 11.9963C22.9797 12.1674 22.8755 12.294 22.749 12.3981C22.6225 12.5023 22.4513 12.547 22.2802 12.547C22.109 12.547 21.9602 12.5023 21.8337 12.3981C21.7071 12.294 21.5955 12.1674 21.5583 12.0186L19.2737 4.42791C19.2513 4.36093 19.229 4.27907 19.229 4.18977Z" fill="#1F2937"></path><path d="M30.9351 11.8101V4.18967C30.9351 3.97386 31.0169 3.81014 31.1509 3.6613C31.2997 3.51246 31.4932 3.4306 31.709 3.4306H34.2467C35.0802 3.4306 35.7425 3.6613 36.2485 4.13014C36.762 4.59898 37.0374 5.27618 37.0374 6.15432C37.0374 7.04735 36.7844 7.70967 36.2709 8.17851C35.7574 8.64735 35.0802 8.87805 34.269 8.87805H32.4978V11.8176C32.4978 12.0334 32.4309 12.2194 32.282 12.3683C32.1332 12.5171 31.962 12.5841 31.7239 12.5841C31.4858 12.5841 31.322 12.5022 31.1732 12.3534C31.002 12.1897 30.9351 12.0185 30.9351 11.8101ZM32.4755 7.48642H34.1202C34.5444 7.48642 34.8644 7.35991 35.1025 7.12177C35.3406 6.89107 35.4448 6.54874 35.4448 6.12456C35.4448 5.70037 35.3406 5.35805 35.1025 5.12735C34.8644 4.89665 34.5444 4.78502 34.1425 4.78502H32.4978V7.48642H32.4755V7.48642Z" fill="#1F2937"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M14.3916 15.9999H1.64367C0.720884 15.9999 -0.000976562 15.278 -0.000976562 14.3627V1.63709C-0.000976562 0.721738 0.720884 -0.00012207 1.64367 -0.00012207H14.3916C15.3069 -0.00012207 16.0362 0.721738 16.0362 1.63709V14.3627C16.0362 15.278 15.3069 15.9999 14.3916 15.9999ZM3.96553 13.0231C3.88367 13.0231 3.77205 13.0008 3.69019 12.9785C3.30321 12.8296 3.11716 12.4055 3.266 12.0185L6.61484 3.44546C6.76367 3.06592 7.18786 2.87244 7.57484 3.02127C7.96181 3.17011 8.14786 3.5943 7.99902 3.98127L4.66507 12.5543C4.56088 12.852 4.26321 13.0231 3.96553 13.0231ZM8.76554 11.9366C8.91437 12.0855 9.10786 12.1524 9.30135 12.1524C9.49484 12.1524 9.68833 12.0855 9.83716 11.9366L12.4567 9.33941C12.9255 8.87058 12.9255 8.08174 12.4567 7.6129L9.83716 4.99337C9.56181 4.69569 9.09298 4.69569 8.7953 4.99337C8.49763 5.26872 8.49763 5.73755 8.7953 6.03523L11.2065 8.46127L8.77298 10.8873C8.46042 11.1701 8.46042 11.6389 8.76554 11.9366Z" fill="#1F2937"></path></svg>
			<a href="https://library.wpcode.com/use-snippet/" >1-click Use in WordPress</a>
		</div>
		</div></div>


<p><strong>Note:</strong> You will need to edit this code to match your theme.</p>



<p>After adding this code, you can add the expiration custom field to the post you want to expire. Make sure you add the time in this format <strong>mm/dd/yyyy 00:00:00</strong>.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="680" height="265" src="https://www.wpbeginner.com/wp-content/uploads/2020/04/adding-an-expiration-date-using-custom-field.png" alt="Adding an expiration date using custom field" class="wp-image-192547" title="Adding an expiration date using custom field" srcset="https://www.wpbeginner.com/wp-content/uploads/2020/04/adding-an-expiration-date-using-custom-field.png 680w, https://www.wpbeginner.com/wp-content/uploads/2020/04/adding-an-expiration-date-using-custom-field-300x117.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<h4 class="wp-block-heading" id="styleposts">How to Style Individual Posts Using Custom Fields</h4>



<p>Want to change the look of an individual post using CSS? WordPress automatically assigns each post its own class, which you can use to add custom CSS.</p>



<p>However, by using custom fields, you can add your own custom classes and then use them to style posts differently.</p>



<p>First, you need to edit a post that you would like to style differently. Go to the Custom Fields box and add the post-class custom field.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="680" height="262" src="https://www.wpbeginner.com/wp-content/uploads/2020/04/post-class-custom-field.png" alt="Post class custom field" class="wp-image-192548" title="Post class custom field" srcset="https://www.wpbeginner.com/wp-content/uploads/2020/04/post-class-custom-field.png 680w, https://www.wpbeginner.com/wp-content/uploads/2020/04/post-class-custom-field-300x116.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<p>Next, you need to edit your WordPress theme files and add this code at the beginning of the WordPress loop:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: php; title: ; notranslate">
&lt;?php $custom_values = get_post_meta($post-&gt;ID, 'post-class'); ?&gt;
</pre><div class="wpcode-syntax-footer">
		<div class="wpcode-syntax-code-footer-left">Hosted with ❤️ by <strong><a href="https://wpcode.com/" >WPCode</a></strong></div>
		<div class="wpcode-syntax-code-footer-right">
			<svg width="65" height="16" viewBox="0 0 65 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M38.0415 7.99972C38.0415 6.44437 38.4062 5.38018 39.128 4.59879C39.8499 3.80995 40.8769 3.42297 42.1941 3.42297C42.8117 3.42297 43.4071 3.54949 43.9206 3.80251C44.4564 4.05553 44.8582 4.39786 45.1782 4.82204C45.2452 4.9039 45.2601 4.99321 45.2601 5.09739C45.2601 5.2239 45.2155 5.31321 45.1336 5.39507C45.0517 5.47693 44.9624 5.52158 44.8359 5.52158C44.6871 5.52158 44.5829 5.4546 44.4936 5.35042C44.2555 5.03042 43.9429 4.75507 43.5113 4.53925C43.1094 4.32344 42.6555 4.21925 42.1643 4.21925C41.1224 4.21925 40.3336 4.53925 39.7755 5.17925C39.2248 5.81925 38.942 6.68995 38.942 7.96995C38.942 9.30948 39.2173 10.2025 39.7531 10.7979C40.2889 11.3932 41.0927 11.7132 42.1643 11.7132C42.6331 11.7132 43.0573 11.6313 43.4889 11.4379C43.8908 11.2444 44.2331 10.9913 44.4936 10.6267C44.5755 10.5225 44.6871 10.4555 44.8359 10.4555C44.9624 10.4555 45.0517 10.5002 45.1336 10.582C45.2155 10.6639 45.2601 10.7755 45.2601 10.8797C45.2601 10.9616 45.2378 11.0509 45.1782 11.1327C44.8806 11.5569 44.4713 11.8993 43.9206 12.1523C43.3699 12.4053 42.7894 12.5318 42.1717 12.5318C40.8322 12.5318 39.8052 12.1523 39.0982 11.4006C38.3987 10.6788 38.0415 9.59228 38.0415 7.99972Z" fill="#1F2937"></path><path d="M46.9268 11.7654C46.4356 11.237 46.1826 10.4258 46.1826 9.36164C46.1826 8.29745 46.4208 7.50862 46.9045 6.98024C47.3956 6.45187 48.0803 6.19141 48.9733 6.19141C49.8663 6.19141 50.551 6.44443 51.0422 6.98024C51.5333 7.50862 51.764 8.29745 51.764 9.36164C51.764 10.4258 51.5259 11.237 51.0422 11.7654C50.551 12.2937 49.8663 12.5765 48.9733 12.5765C48.1026 12.5765 47.418 12.3012 46.9268 11.7654ZM47.0608 9.36164C47.0608 10.9765 47.7008 11.7877 48.9808 11.7877C50.2608 11.7877 50.9008 10.9765 50.9008 9.36164C50.9008 7.74676 50.2608 6.93559 48.9808 6.93559C47.6933 6.93559 47.0608 7.76908 47.0608 9.36164Z" fill="#1F2937"></path><path d="M52.583 9.3839C52.583 7.25553 53.476 6.31786 55.2472 6.31786C55.6491 6.31786 56.0137 6.39972 56.3337 6.57088C56.6537 6.74204 56.9067 6.93553 57.0556 7.18855V3.84716C57.0556 3.72065 57.1002 3.63135 57.1821 3.54949C57.2639 3.46762 57.3532 3.42297 57.4798 3.42297C57.6063 3.42297 57.6956 3.46762 57.7774 3.54949C57.8593 3.63135 57.9039 3.72065 57.9039 3.84716V9.95693C57.9039 10.8053 57.6658 11.4453 57.1821 11.8918C56.7132 12.3383 56.0732 12.569 55.2844 12.569C54.4137 12.569 53.7291 12.2937 53.2602 11.7579C52.8137 11.2369 52.583 10.4481 52.583 9.3839ZM53.4314 9.3839C53.4314 10.9988 54.0491 11.81 55.3067 11.81C55.8425 11.81 56.2667 11.6611 56.5867 11.3411C56.9067 11.0211 57.0556 10.5746 57.0556 9.95693V8.25274C57.0332 8.23042 57.0109 8.18576 56.9886 8.12623C56.9663 8.05925 56.9067 7.97739 56.7951 7.85088C56.6909 7.72437 56.5793 7.59786 56.4528 7.48623C56.3263 7.38204 56.1551 7.29274 55.9616 7.21088C55.7458 7.12902 55.5374 7.08437 55.2993 7.08437C54.6816 7.08437 54.2351 7.27786 53.8928 7.67972C53.5802 8.08158 53.4314 8.57274 53.4314 9.3839Z" fill="#1F2937"></path><path d="M58.9312 9.36193C58.9312 8.3424 59.1693 7.55356 59.653 7.00286C60.1367 6.45216 60.8065 6.16937 61.6772 6.16937C62.0195 6.16937 62.3395 6.21402 62.5925 6.29588C62.8679 6.37774 63.106 6.48937 63.2772 6.63821C63.4484 6.78705 63.6195 6.93588 63.746 7.12937C63.8725 7.30054 63.9842 7.49402 64.0437 7.7024C64.1107 7.91821 64.1479 8.08193 64.1925 8.25309C64.2372 8.42426 64.2372 8.59542 64.2372 8.76658C64.2372 8.89309 64.2372 8.99728 64.2372 9.06426C64.2372 9.13123 64.2149 9.21309 64.1702 9.31728C64.1479 9.42147 64.0884 9.48844 63.9991 9.53309C63.9172 9.57774 63.8279 9.60007 63.7014 9.60007H59.8316C59.8316 10.2624 60.0028 10.7908 60.3674 11.1777C60.7321 11.5573 61.2232 11.7731 61.8409 11.7731C62.1832 11.7731 62.4809 11.7284 62.7116 11.6243C62.9498 11.5201 63.2028 11.3936 63.4335 11.2001C63.5153 11.1331 63.6046 11.1182 63.6716 11.1182C63.7758 11.1182 63.8651 11.1629 63.947 11.2224C64.0139 11.3043 64.0512 11.3936 64.0512 11.4977C64.0512 11.6019 64.0065 11.7136 63.9023 11.7954C63.8205 11.8773 63.6865 11.9889 63.5377 12.0931C63.3888 12.1973 63.1507 12.2866 62.8307 12.3908C62.5107 12.495 62.1684 12.5396 61.8037 12.5396C60.8884 12.5396 60.1814 12.2866 59.6902 11.7508C59.1916 11.2522 58.9312 10.4484 58.9312 9.36193ZM59.8093 8.87077H63.3888C63.3888 8.61774 63.3665 8.37961 63.307 8.17123C63.2623 7.95542 63.1805 7.76937 63.0539 7.57588C62.9274 7.3824 62.7563 7.23356 62.5181 7.12937C62.28 7.02519 62.0046 6.95821 61.6846 6.95821C61.1116 6.95821 60.68 7.12937 60.3377 7.4717C60.0251 7.80658 59.8316 8.27542 59.8093 8.87077Z" fill="#1F2937"></path><path d="M19.229 4.18977C19.229 3.97395 19.3109 3.78791 19.4671 3.63907C19.616 3.49023 19.8095 3.40837 20.0253 3.40837C20.2188 3.40837 20.3899 3.47535 20.5164 3.57954C20.643 3.68372 20.7323 3.81023 20.7695 3.94419L22.3248 9.51814L23.8355 3.96651C23.8802 3.79535 23.962 3.66884 24.1109 3.56465C24.2597 3.46047 24.4085 3.41581 24.5574 3.41581C24.7285 3.41581 24.8774 3.46047 25.0039 3.56465C25.1304 3.66884 25.242 3.79535 25.2792 3.96651L26.7899 9.51814L28.3453 3.92186C28.3899 3.79535 28.4718 3.66884 28.5983 3.55721C28.7248 3.45302 28.8737 3.38605 29.0895 3.38605C29.3053 3.38605 29.4764 3.45302 29.6253 3.60186C29.7741 3.7507 29.8411 3.92186 29.8411 4.13023C29.8411 4.21209 29.8188 4.3014 29.7964 4.36093L27.5118 11.9591C27.4671 12.1079 27.3853 12.2567 27.2364 12.3386C27.1099 12.4428 26.9611 12.4874 26.7899 12.4874C26.6188 12.4874 26.4699 12.4428 26.3434 12.3386C26.2169 12.2344 26.1276 12.1079 26.0904 11.9367L24.5574 6.4893L23.0244 11.9963C22.9797 12.1674 22.8755 12.294 22.749 12.3981C22.6225 12.5023 22.4513 12.547 22.2802 12.547C22.109 12.547 21.9602 12.5023 21.8337 12.3981C21.7071 12.294 21.5955 12.1674 21.5583 12.0186L19.2737 4.42791C19.2513 4.36093 19.229 4.27907 19.229 4.18977Z" fill="#1F2937"></path><path d="M30.9351 11.8101V4.18967C30.9351 3.97386 31.0169 3.81014 31.1509 3.6613C31.2997 3.51246 31.4932 3.4306 31.709 3.4306H34.2467C35.0802 3.4306 35.7425 3.6613 36.2485 4.13014C36.762 4.59898 37.0374 5.27618 37.0374 6.15432C37.0374 7.04735 36.7844 7.70967 36.2709 8.17851C35.7574 8.64735 35.0802 8.87805 34.269 8.87805H32.4978V11.8176C32.4978 12.0334 32.4309 12.2194 32.282 12.3683C32.1332 12.5171 31.962 12.5841 31.7239 12.5841C31.4858 12.5841 31.322 12.5022 31.1732 12.3534C31.002 12.1897 30.9351 12.0185 30.9351 11.8101ZM32.4755 7.48642H34.1202C34.5444 7.48642 34.8644 7.35991 35.1025 7.12177C35.3406 6.89107 35.4448 6.54874 35.4448 6.12456C35.4448 5.70037 35.3406 5.35805 35.1025 5.12735C34.8644 4.89665 34.5444 4.78502 34.1425 4.78502H32.4978V7.48642H32.4755V7.48642Z" fill="#1F2937"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M14.3916 15.9999H1.64367C0.720884 15.9999 -0.000976562 15.278 -0.000976562 14.3627V1.63709C-0.000976562 0.721738 0.720884 -0.00012207 1.64367 -0.00012207H14.3916C15.3069 -0.00012207 16.0362 0.721738 16.0362 1.63709V14.3627C16.0362 15.278 15.3069 15.9999 14.3916 15.9999ZM3.96553 13.0231C3.88367 13.0231 3.77205 13.0008 3.69019 12.9785C3.30321 12.8296 3.11716 12.4055 3.266 12.0185L6.61484 3.44546C6.76367 3.06592 7.18786 2.87244 7.57484 3.02127C7.96181 3.17011 8.14786 3.5943 7.99902 3.98127L4.66507 12.5543C4.56088 12.852 4.26321 13.0231 3.96553 13.0231ZM8.76554 11.9366C8.91437 12.0855 9.10786 12.1524 9.30135 12.1524C9.49484 12.1524 9.68833 12.0855 9.83716 11.9366L12.4567 9.33941C12.9255 8.87058 12.9255 8.08174 12.4567 7.6129L9.83716 4.99337C9.56181 4.69569 9.09298 4.69569 8.7953 4.99337C8.49763 5.26872 8.49763 5.73755 8.7953 6.03523L11.2065 8.46127L8.77298 10.8873C8.46042 11.1701 8.46042 11.6389 8.76554 11.9366Z" fill="#1F2937"></path></svg>
			<a href="https://library.wpcode.com/use-snippet/" >1-click Use in WordPress</a>
		</div>
		</div></div>


<p>Now you need to find the line with the <code>post_class()</code> function. </p>



<p>Here is how it looked in our demo theme:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: php; title: ; notranslate">
&lt;article id=&quot;post-&lt;?php the_ID(); ?&gt;&quot; &lt;?php post_class(); ?&gt;&gt;
</pre><div class="wpcode-syntax-footer">
		<div class="wpcode-syntax-code-footer-left">Hosted with ❤️ by <strong><a href="https://wpcode.com/" >WPCode</a></strong></div>
		<div class="wpcode-syntax-code-footer-right">
			<svg width="65" height="16" viewBox="0 0 65 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M38.0415 7.99972C38.0415 6.44437 38.4062 5.38018 39.128 4.59879C39.8499 3.80995 40.8769 3.42297 42.1941 3.42297C42.8117 3.42297 43.4071 3.54949 43.9206 3.80251C44.4564 4.05553 44.8582 4.39786 45.1782 4.82204C45.2452 4.9039 45.2601 4.99321 45.2601 5.09739C45.2601 5.2239 45.2155 5.31321 45.1336 5.39507C45.0517 5.47693 44.9624 5.52158 44.8359 5.52158C44.6871 5.52158 44.5829 5.4546 44.4936 5.35042C44.2555 5.03042 43.9429 4.75507 43.5113 4.53925C43.1094 4.32344 42.6555 4.21925 42.1643 4.21925C41.1224 4.21925 40.3336 4.53925 39.7755 5.17925C39.2248 5.81925 38.942 6.68995 38.942 7.96995C38.942 9.30948 39.2173 10.2025 39.7531 10.7979C40.2889 11.3932 41.0927 11.7132 42.1643 11.7132C42.6331 11.7132 43.0573 11.6313 43.4889 11.4379C43.8908 11.2444 44.2331 10.9913 44.4936 10.6267C44.5755 10.5225 44.6871 10.4555 44.8359 10.4555C44.9624 10.4555 45.0517 10.5002 45.1336 10.582C45.2155 10.6639 45.2601 10.7755 45.2601 10.8797C45.2601 10.9616 45.2378 11.0509 45.1782 11.1327C44.8806 11.5569 44.4713 11.8993 43.9206 12.1523C43.3699 12.4053 42.7894 12.5318 42.1717 12.5318C40.8322 12.5318 39.8052 12.1523 39.0982 11.4006C38.3987 10.6788 38.0415 9.59228 38.0415 7.99972Z" fill="#1F2937"></path><path d="M46.9268 11.7654C46.4356 11.237 46.1826 10.4258 46.1826 9.36164C46.1826 8.29745 46.4208 7.50862 46.9045 6.98024C47.3956 6.45187 48.0803 6.19141 48.9733 6.19141C49.8663 6.19141 50.551 6.44443 51.0422 6.98024C51.5333 7.50862 51.764 8.29745 51.764 9.36164C51.764 10.4258 51.5259 11.237 51.0422 11.7654C50.551 12.2937 49.8663 12.5765 48.9733 12.5765C48.1026 12.5765 47.418 12.3012 46.9268 11.7654ZM47.0608 9.36164C47.0608 10.9765 47.7008 11.7877 48.9808 11.7877C50.2608 11.7877 50.9008 10.9765 50.9008 9.36164C50.9008 7.74676 50.2608 6.93559 48.9808 6.93559C47.6933 6.93559 47.0608 7.76908 47.0608 9.36164Z" fill="#1F2937"></path><path d="M52.583 9.3839C52.583 7.25553 53.476 6.31786 55.2472 6.31786C55.6491 6.31786 56.0137 6.39972 56.3337 6.57088C56.6537 6.74204 56.9067 6.93553 57.0556 7.18855V3.84716C57.0556 3.72065 57.1002 3.63135 57.1821 3.54949C57.2639 3.46762 57.3532 3.42297 57.4798 3.42297C57.6063 3.42297 57.6956 3.46762 57.7774 3.54949C57.8593 3.63135 57.9039 3.72065 57.9039 3.84716V9.95693C57.9039 10.8053 57.6658 11.4453 57.1821 11.8918C56.7132 12.3383 56.0732 12.569 55.2844 12.569C54.4137 12.569 53.7291 12.2937 53.2602 11.7579C52.8137 11.2369 52.583 10.4481 52.583 9.3839ZM53.4314 9.3839C53.4314 10.9988 54.0491 11.81 55.3067 11.81C55.8425 11.81 56.2667 11.6611 56.5867 11.3411C56.9067 11.0211 57.0556 10.5746 57.0556 9.95693V8.25274C57.0332 8.23042 57.0109 8.18576 56.9886 8.12623C56.9663 8.05925 56.9067 7.97739 56.7951 7.85088C56.6909 7.72437 56.5793 7.59786 56.4528 7.48623C56.3263 7.38204 56.1551 7.29274 55.9616 7.21088C55.7458 7.12902 55.5374 7.08437 55.2993 7.08437C54.6816 7.08437 54.2351 7.27786 53.8928 7.67972C53.5802 8.08158 53.4314 8.57274 53.4314 9.3839Z" fill="#1F2937"></path><path d="M58.9312 9.36193C58.9312 8.3424 59.1693 7.55356 59.653 7.00286C60.1367 6.45216 60.8065 6.16937 61.6772 6.16937C62.0195 6.16937 62.3395 6.21402 62.5925 6.29588C62.8679 6.37774 63.106 6.48937 63.2772 6.63821C63.4484 6.78705 63.6195 6.93588 63.746 7.12937C63.8725 7.30054 63.9842 7.49402 64.0437 7.7024C64.1107 7.91821 64.1479 8.08193 64.1925 8.25309C64.2372 8.42426 64.2372 8.59542 64.2372 8.76658C64.2372 8.89309 64.2372 8.99728 64.2372 9.06426C64.2372 9.13123 64.2149 9.21309 64.1702 9.31728C64.1479 9.42147 64.0884 9.48844 63.9991 9.53309C63.9172 9.57774 63.8279 9.60007 63.7014 9.60007H59.8316C59.8316 10.2624 60.0028 10.7908 60.3674 11.1777C60.7321 11.5573 61.2232 11.7731 61.8409 11.7731C62.1832 11.7731 62.4809 11.7284 62.7116 11.6243C62.9498 11.5201 63.2028 11.3936 63.4335 11.2001C63.5153 11.1331 63.6046 11.1182 63.6716 11.1182C63.7758 11.1182 63.8651 11.1629 63.947 11.2224C64.0139 11.3043 64.0512 11.3936 64.0512 11.4977C64.0512 11.6019 64.0065 11.7136 63.9023 11.7954C63.8205 11.8773 63.6865 11.9889 63.5377 12.0931C63.3888 12.1973 63.1507 12.2866 62.8307 12.3908C62.5107 12.495 62.1684 12.5396 61.8037 12.5396C60.8884 12.5396 60.1814 12.2866 59.6902 11.7508C59.1916 11.2522 58.9312 10.4484 58.9312 9.36193ZM59.8093 8.87077H63.3888C63.3888 8.61774 63.3665 8.37961 63.307 8.17123C63.2623 7.95542 63.1805 7.76937 63.0539 7.57588C62.9274 7.3824 62.7563 7.23356 62.5181 7.12937C62.28 7.02519 62.0046 6.95821 61.6846 6.95821C61.1116 6.95821 60.68 7.12937 60.3377 7.4717C60.0251 7.80658 59.8316 8.27542 59.8093 8.87077Z" fill="#1F2937"></path><path d="M19.229 4.18977C19.229 3.97395 19.3109 3.78791 19.4671 3.63907C19.616 3.49023 19.8095 3.40837 20.0253 3.40837C20.2188 3.40837 20.3899 3.47535 20.5164 3.57954C20.643 3.68372 20.7323 3.81023 20.7695 3.94419L22.3248 9.51814L23.8355 3.96651C23.8802 3.79535 23.962 3.66884 24.1109 3.56465C24.2597 3.46047 24.4085 3.41581 24.5574 3.41581C24.7285 3.41581 24.8774 3.46047 25.0039 3.56465C25.1304 3.66884 25.242 3.79535 25.2792 3.96651L26.7899 9.51814L28.3453 3.92186C28.3899 3.79535 28.4718 3.66884 28.5983 3.55721C28.7248 3.45302 28.8737 3.38605 29.0895 3.38605C29.3053 3.38605 29.4764 3.45302 29.6253 3.60186C29.7741 3.7507 29.8411 3.92186 29.8411 4.13023C29.8411 4.21209 29.8188 4.3014 29.7964 4.36093L27.5118 11.9591C27.4671 12.1079 27.3853 12.2567 27.2364 12.3386C27.1099 12.4428 26.9611 12.4874 26.7899 12.4874C26.6188 12.4874 26.4699 12.4428 26.3434 12.3386C26.2169 12.2344 26.1276 12.1079 26.0904 11.9367L24.5574 6.4893L23.0244 11.9963C22.9797 12.1674 22.8755 12.294 22.749 12.3981C22.6225 12.5023 22.4513 12.547 22.2802 12.547C22.109 12.547 21.9602 12.5023 21.8337 12.3981C21.7071 12.294 21.5955 12.1674 21.5583 12.0186L19.2737 4.42791C19.2513 4.36093 19.229 4.27907 19.229 4.18977Z" fill="#1F2937"></path><path d="M30.9351 11.8101V4.18967C30.9351 3.97386 31.0169 3.81014 31.1509 3.6613C31.2997 3.51246 31.4932 3.4306 31.709 3.4306H34.2467C35.0802 3.4306 35.7425 3.6613 36.2485 4.13014C36.762 4.59898 37.0374 5.27618 37.0374 6.15432C37.0374 7.04735 36.7844 7.70967 36.2709 8.17851C35.7574 8.64735 35.0802 8.87805 34.269 8.87805H32.4978V11.8176C32.4978 12.0334 32.4309 12.2194 32.282 12.3683C32.1332 12.5171 31.962 12.5841 31.7239 12.5841C31.4858 12.5841 31.322 12.5022 31.1732 12.3534C31.002 12.1897 30.9351 12.0185 30.9351 11.8101ZM32.4755 7.48642H34.1202C34.5444 7.48642 34.8644 7.35991 35.1025 7.12177C35.3406 6.89107 35.4448 6.54874 35.4448 6.12456C35.4448 5.70037 35.3406 5.35805 35.1025 5.12735C34.8644 4.89665 34.5444 4.78502 34.1425 4.78502H32.4978V7.48642H32.4755V7.48642Z" fill="#1F2937"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M14.3916 15.9999H1.64367C0.720884 15.9999 -0.000976562 15.278 -0.000976562 14.3627V1.63709C-0.000976562 0.721738 0.720884 -0.00012207 1.64367 -0.00012207H14.3916C15.3069 -0.00012207 16.0362 0.721738 16.0362 1.63709V14.3627C16.0362 15.278 15.3069 15.9999 14.3916 15.9999ZM3.96553 13.0231C3.88367 13.0231 3.77205 13.0008 3.69019 12.9785C3.30321 12.8296 3.11716 12.4055 3.266 12.0185L6.61484 3.44546C6.76367 3.06592 7.18786 2.87244 7.57484 3.02127C7.96181 3.17011 8.14786 3.5943 7.99902 3.98127L4.66507 12.5543C4.56088 12.852 4.26321 13.0231 3.96553 13.0231ZM8.76554 11.9366C8.91437 12.0855 9.10786 12.1524 9.30135 12.1524C9.49484 12.1524 9.68833 12.0855 9.83716 11.9366L12.4567 9.33941C12.9255 8.87058 12.9255 8.08174 12.4567 7.6129L9.83716 4.99337C9.56181 4.69569 9.09298 4.69569 8.7953 4.99337C8.49763 5.26872 8.49763 5.73755 8.7953 6.03523L11.2065 8.46127L8.77298 10.8873C8.46042 11.1701 8.46042 11.6389 8.76554 11.9366Z" fill="#1F2937"></path></svg>
			<a href="https://library.wpcode.com/use-snippet/" >1-click Use in WordPress</a>
		</div>
		</div></div>


<p>You must change this line to include your custom field value, like this:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: php; title: ; notranslate">
&lt;article id=&quot;post-&lt;?php the_ID(); ?&gt;&quot; &lt;?php post_class($custom_values); ?&gt;&gt;
</pre><div class="wpcode-syntax-footer">
		<div class="wpcode-syntax-code-footer-left">Hosted with ❤️ by <strong><a href="https://wpcode.com/" >WPCode</a></strong></div>
		<div class="wpcode-syntax-code-footer-right">
			<svg width="65" height="16" viewBox="0 0 65 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M38.0415 7.99972C38.0415 6.44437 38.4062 5.38018 39.128 4.59879C39.8499 3.80995 40.8769 3.42297 42.1941 3.42297C42.8117 3.42297 43.4071 3.54949 43.9206 3.80251C44.4564 4.05553 44.8582 4.39786 45.1782 4.82204C45.2452 4.9039 45.2601 4.99321 45.2601 5.09739C45.2601 5.2239 45.2155 5.31321 45.1336 5.39507C45.0517 5.47693 44.9624 5.52158 44.8359 5.52158C44.6871 5.52158 44.5829 5.4546 44.4936 5.35042C44.2555 5.03042 43.9429 4.75507 43.5113 4.53925C43.1094 4.32344 42.6555 4.21925 42.1643 4.21925C41.1224 4.21925 40.3336 4.53925 39.7755 5.17925C39.2248 5.81925 38.942 6.68995 38.942 7.96995C38.942 9.30948 39.2173 10.2025 39.7531 10.7979C40.2889 11.3932 41.0927 11.7132 42.1643 11.7132C42.6331 11.7132 43.0573 11.6313 43.4889 11.4379C43.8908 11.2444 44.2331 10.9913 44.4936 10.6267C44.5755 10.5225 44.6871 10.4555 44.8359 10.4555C44.9624 10.4555 45.0517 10.5002 45.1336 10.582C45.2155 10.6639 45.2601 10.7755 45.2601 10.8797C45.2601 10.9616 45.2378 11.0509 45.1782 11.1327C44.8806 11.5569 44.4713 11.8993 43.9206 12.1523C43.3699 12.4053 42.7894 12.5318 42.1717 12.5318C40.8322 12.5318 39.8052 12.1523 39.0982 11.4006C38.3987 10.6788 38.0415 9.59228 38.0415 7.99972Z" fill="#1F2937"></path><path d="M46.9268 11.7654C46.4356 11.237 46.1826 10.4258 46.1826 9.36164C46.1826 8.29745 46.4208 7.50862 46.9045 6.98024C47.3956 6.45187 48.0803 6.19141 48.9733 6.19141C49.8663 6.19141 50.551 6.44443 51.0422 6.98024C51.5333 7.50862 51.764 8.29745 51.764 9.36164C51.764 10.4258 51.5259 11.237 51.0422 11.7654C50.551 12.2937 49.8663 12.5765 48.9733 12.5765C48.1026 12.5765 47.418 12.3012 46.9268 11.7654ZM47.0608 9.36164C47.0608 10.9765 47.7008 11.7877 48.9808 11.7877C50.2608 11.7877 50.9008 10.9765 50.9008 9.36164C50.9008 7.74676 50.2608 6.93559 48.9808 6.93559C47.6933 6.93559 47.0608 7.76908 47.0608 9.36164Z" fill="#1F2937"></path><path d="M52.583 9.3839C52.583 7.25553 53.476 6.31786 55.2472 6.31786C55.6491 6.31786 56.0137 6.39972 56.3337 6.57088C56.6537 6.74204 56.9067 6.93553 57.0556 7.18855V3.84716C57.0556 3.72065 57.1002 3.63135 57.1821 3.54949C57.2639 3.46762 57.3532 3.42297 57.4798 3.42297C57.6063 3.42297 57.6956 3.46762 57.7774 3.54949C57.8593 3.63135 57.9039 3.72065 57.9039 3.84716V9.95693C57.9039 10.8053 57.6658 11.4453 57.1821 11.8918C56.7132 12.3383 56.0732 12.569 55.2844 12.569C54.4137 12.569 53.7291 12.2937 53.2602 11.7579C52.8137 11.2369 52.583 10.4481 52.583 9.3839ZM53.4314 9.3839C53.4314 10.9988 54.0491 11.81 55.3067 11.81C55.8425 11.81 56.2667 11.6611 56.5867 11.3411C56.9067 11.0211 57.0556 10.5746 57.0556 9.95693V8.25274C57.0332 8.23042 57.0109 8.18576 56.9886 8.12623C56.9663 8.05925 56.9067 7.97739 56.7951 7.85088C56.6909 7.72437 56.5793 7.59786 56.4528 7.48623C56.3263 7.38204 56.1551 7.29274 55.9616 7.21088C55.7458 7.12902 55.5374 7.08437 55.2993 7.08437C54.6816 7.08437 54.2351 7.27786 53.8928 7.67972C53.5802 8.08158 53.4314 8.57274 53.4314 9.3839Z" fill="#1F2937"></path><path d="M58.9312 9.36193C58.9312 8.3424 59.1693 7.55356 59.653 7.00286C60.1367 6.45216 60.8065 6.16937 61.6772 6.16937C62.0195 6.16937 62.3395 6.21402 62.5925 6.29588C62.8679 6.37774 63.106 6.48937 63.2772 6.63821C63.4484 6.78705 63.6195 6.93588 63.746 7.12937C63.8725 7.30054 63.9842 7.49402 64.0437 7.7024C64.1107 7.91821 64.1479 8.08193 64.1925 8.25309C64.2372 8.42426 64.2372 8.59542 64.2372 8.76658C64.2372 8.89309 64.2372 8.99728 64.2372 9.06426C64.2372 9.13123 64.2149 9.21309 64.1702 9.31728C64.1479 9.42147 64.0884 9.48844 63.9991 9.53309C63.9172 9.57774 63.8279 9.60007 63.7014 9.60007H59.8316C59.8316 10.2624 60.0028 10.7908 60.3674 11.1777C60.7321 11.5573 61.2232 11.7731 61.8409 11.7731C62.1832 11.7731 62.4809 11.7284 62.7116 11.6243C62.9498 11.5201 63.2028 11.3936 63.4335 11.2001C63.5153 11.1331 63.6046 11.1182 63.6716 11.1182C63.7758 11.1182 63.8651 11.1629 63.947 11.2224C64.0139 11.3043 64.0512 11.3936 64.0512 11.4977C64.0512 11.6019 64.0065 11.7136 63.9023 11.7954C63.8205 11.8773 63.6865 11.9889 63.5377 12.0931C63.3888 12.1973 63.1507 12.2866 62.8307 12.3908C62.5107 12.495 62.1684 12.5396 61.8037 12.5396C60.8884 12.5396 60.1814 12.2866 59.6902 11.7508C59.1916 11.2522 58.9312 10.4484 58.9312 9.36193ZM59.8093 8.87077H63.3888C63.3888 8.61774 63.3665 8.37961 63.307 8.17123C63.2623 7.95542 63.1805 7.76937 63.0539 7.57588C62.9274 7.3824 62.7563 7.23356 62.5181 7.12937C62.28 7.02519 62.0046 6.95821 61.6846 6.95821C61.1116 6.95821 60.68 7.12937 60.3377 7.4717C60.0251 7.80658 59.8316 8.27542 59.8093 8.87077Z" fill="#1F2937"></path><path d="M19.229 4.18977C19.229 3.97395 19.3109 3.78791 19.4671 3.63907C19.616 3.49023 19.8095 3.40837 20.0253 3.40837C20.2188 3.40837 20.3899 3.47535 20.5164 3.57954C20.643 3.68372 20.7323 3.81023 20.7695 3.94419L22.3248 9.51814L23.8355 3.96651C23.8802 3.79535 23.962 3.66884 24.1109 3.56465C24.2597 3.46047 24.4085 3.41581 24.5574 3.41581C24.7285 3.41581 24.8774 3.46047 25.0039 3.56465C25.1304 3.66884 25.242 3.79535 25.2792 3.96651L26.7899 9.51814L28.3453 3.92186C28.3899 3.79535 28.4718 3.66884 28.5983 3.55721C28.7248 3.45302 28.8737 3.38605 29.0895 3.38605C29.3053 3.38605 29.4764 3.45302 29.6253 3.60186C29.7741 3.7507 29.8411 3.92186 29.8411 4.13023C29.8411 4.21209 29.8188 4.3014 29.7964 4.36093L27.5118 11.9591C27.4671 12.1079 27.3853 12.2567 27.2364 12.3386C27.1099 12.4428 26.9611 12.4874 26.7899 12.4874C26.6188 12.4874 26.4699 12.4428 26.3434 12.3386C26.2169 12.2344 26.1276 12.1079 26.0904 11.9367L24.5574 6.4893L23.0244 11.9963C22.9797 12.1674 22.8755 12.294 22.749 12.3981C22.6225 12.5023 22.4513 12.547 22.2802 12.547C22.109 12.547 21.9602 12.5023 21.8337 12.3981C21.7071 12.294 21.5955 12.1674 21.5583 12.0186L19.2737 4.42791C19.2513 4.36093 19.229 4.27907 19.229 4.18977Z" fill="#1F2937"></path><path d="M30.9351 11.8101V4.18967C30.9351 3.97386 31.0169 3.81014 31.1509 3.6613C31.2997 3.51246 31.4932 3.4306 31.709 3.4306H34.2467C35.0802 3.4306 35.7425 3.6613 36.2485 4.13014C36.762 4.59898 37.0374 5.27618 37.0374 6.15432C37.0374 7.04735 36.7844 7.70967 36.2709 8.17851C35.7574 8.64735 35.0802 8.87805 34.269 8.87805H32.4978V11.8176C32.4978 12.0334 32.4309 12.2194 32.282 12.3683C32.1332 12.5171 31.962 12.5841 31.7239 12.5841C31.4858 12.5841 31.322 12.5022 31.1732 12.3534C31.002 12.1897 30.9351 12.0185 30.9351 11.8101ZM32.4755 7.48642H34.1202C34.5444 7.48642 34.8644 7.35991 35.1025 7.12177C35.3406 6.89107 35.4448 6.54874 35.4448 6.12456C35.4448 5.70037 35.3406 5.35805 35.1025 5.12735C34.8644 4.89665 34.5444 4.78502 34.1425 4.78502H32.4978V7.48642H32.4755V7.48642Z" fill="#1F2937"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M14.3916 15.9999H1.64367C0.720884 15.9999 -0.000976562 15.278 -0.000976562 14.3627V1.63709C-0.000976562 0.721738 0.720884 -0.00012207 1.64367 -0.00012207H14.3916C15.3069 -0.00012207 16.0362 0.721738 16.0362 1.63709V14.3627C16.0362 15.278 15.3069 15.9999 14.3916 15.9999ZM3.96553 13.0231C3.88367 13.0231 3.77205 13.0008 3.69019 12.9785C3.30321 12.8296 3.11716 12.4055 3.266 12.0185L6.61484 3.44546C6.76367 3.06592 7.18786 2.87244 7.57484 3.02127C7.96181 3.17011 8.14786 3.5943 7.99902 3.98127L4.66507 12.5543C4.56088 12.852 4.26321 13.0231 3.96553 13.0231ZM8.76554 11.9366C8.91437 12.0855 9.10786 12.1524 9.30135 12.1524C9.49484 12.1524 9.68833 12.0855 9.83716 11.9366L12.4567 9.33941C12.9255 8.87058 12.9255 8.08174 12.4567 7.6129L9.83716 4.99337C9.56181 4.69569 9.09298 4.69569 8.7953 4.99337C8.49763 5.26872 8.49763 5.73755 8.7953 6.03523L11.2065 8.46127L8.77298 10.8873C8.46042 11.1701 8.46042 11.6389 8.76554 11.9366Z" fill="#1F2937"></path></svg>
			<a href="https://library.wpcode.com/use-snippet/" >1-click Use in WordPress</a>
		</div>
		</div></div>


<p>Now if you examine the post&#8217;s source code using the <a href="https://www.wpbeginner.com/wp-tutorials/basics-of-inspect-element-with-your-wordpress-site/" title="Basics of Inspect Element: Customizing WordPress for DIY Users">Inspect tool</a>, then you will see your custom field CSS class added to the post-class.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="680" height="266" src="https://www.wpbeginner.com/wp-content/uploads/2020/04/post-class-preview.png" alt="Post class preview" class="wp-image-192550" title="Custom field post class" srcset="https://www.wpbeginner.com/wp-content/uploads/2020/04/post-class-preview.png 680w, https://www.wpbeginner.com/wp-content/uploads/2020/04/post-class-preview-300x117.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<p>You can now can use this CSS class to add custom CSS and style your post differently.</p>



<p>We hope this article helped you learn more about WordPress custom fields. You may also want to see our guide on <a href="https://www.wpbeginner.com/wp-tutorials/how-to-add-additional-custom-meta-fields-to-custom-taxonomies/" title="How to Add Custom Meta Fields to Custom Taxonomies in WordPress">how to add custom meta fields to custom taxonomies in WordPress</a> and the <a href="https://www.wpbeginner.com/beginners-guide/best-drag-and-drop-page-builders-for-wordpress/" title="Best Drag and Drop WordPress Page Builders Compared">best WordPress page builder plugins</a> to help you design your website the way you want.</p>



<p>If you liked this article, then please subscribe to our <a href="https://youtube.com/wpbeginner?sub_confirmation=1"  rel="noreferrer noopener nofollow" title="Subscribe to WPBeginner YouTube Channel">YouTube Channel</a> for WordPress video tutorials. You can also find us on <a href="https://twitter.com/wpbeginner"  rel="noreferrer noopener nofollow" title="Follow WPBeginner on Twitter">Twitter</a> and <a href="https://facebook.com/wpbeginner"  rel="noreferrer noopener nofollow" title="Join WPBeginner Community on Facebook">Facebook</a>.</p><p>The post <a href="https://www.wpbeginner.com/wp-tutorials/wordpress-custom-fields-101-tips-tricks-and-hacks/">WordPress Custom Fields 101: Tips, Tricks, and Hacks</a> first appeared on <a href="https://www.wpbeginner.com/">WPBeginner</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.wpwife.com/tutorials/wordpress-custom-fields-101-tips-tricks-and-hacks/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="" length="0" type="" />
		</item>
		<item>
		<title>5 Best Custom Post Types Plugins for WordPress Compared</title>
		<link>http://www.wpwife.com/custom-post-types/5-best-custom-post-types-plugins-for-wordpress-compared</link>
		<comments>http://www.wpwife.com/custom-post-types/5-best-custom-post-types-plugins-for-wordpress-compared#comments</comments>
		<pubDate>Mon, 28 Oct 2019 13:30:00 +0000</pubDate>
		<dc:creator><![CDATA[Colin Newcomer]]></dc:creator>
				<category><![CDATA[Admin]]></category>
		<category><![CDATA[Custom Fields]]></category>
		<category><![CDATA[Custom Post Types]]></category>

		<guid isPermaLink="false">https://wplift.com/?p=42212</guid>
		<description><![CDATA[
<p>If you plan to use WordPress for more than just a blog or simple static website, you&#8217;re probably going to use custom post types in some way. Custom post types let you create new content types to organize and display your information. For example, a &#8220;product&#8221; post type for an eCommerce store or an &#8220;event&#8221; ... <a title="5 Best Custom Post Types Plugins for WordPress Compared" href="https://wplift.com/custom-post-types-plugins">Read more<span>5 Best Custom Post Types Plugins for WordPress Compared</span></a></p>
<p>The post <a rel="nofollow" href="https://wplift.com/custom-post-types-plugins">5 Best Custom Post Types Plugins for WordPress Compared</a> appeared first on <a rel="nofollow" href="https://wplift.com/">Learn WordPress with WPLift</a>.</p>
<img src="http://feeds.feedburner.com/~r/Wplift/~4/v1KuJ4Dk9Pk" height="1" width="1" alt="">
]]></description>
				<content:encoded><![CDATA[<p>If you plan to use WordPress for more than just a blog or simple static website, you&#8217;re probably going to use custom post types in some way. Custom post types let you create new content types to organize and display your information. For example, a &#8220;product&#8221; post type for an eCommerce store or an &#8220;event&#8221; ... <a title="5 Best Custom Post Types Plugins for WordPress Compared" class="read-more" href="https://wplift.com/custom-post-types-plugins">Read more<span class="screen-reader-text">5 Best Custom Post Types Plugins for WordPress Compared</span></a></p>
<p>The post <a rel="nofollow" href="https://wplift.com/custom-post-types-plugins">5 Best Custom Post Types Plugins for WordPress Compared</a> appeared first on <a rel="nofollow" href="https://wplift.com/">Learn WordPress with WPLift</a>.</p><img src="http://feeds.feedburner.com/~r/Wplift/~4/v1KuJ4Dk9Pk" height="1" width="1" alt=""/>]]></content:encoded>
			<wfw:commentRss>http://www.wpwife.com/custom-post-types/5-best-custom-post-types-plugins-for-wordpress-compared/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="" length="0" type="" />
		</item>
		<item>
		<title>WordPress Custom Fields 101: Everything You Need to Get Started</title>
		<link>http://www.wpwife.com/technical/wordpress-custom-fields-101-everything-you-need-to-get-started</link>
		<comments>http://www.wpwife.com/technical/wordpress-custom-fields-101-everything-you-need-to-get-started#comments</comments>
		<pubDate>Thu, 20 Jun 2019 08:18:40 +0000</pubDate>
		<dc:creator><![CDATA[Colin Newcomer]]></dc:creator>
				<category><![CDATA[Custom Fields]]></category>
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">https://wplift.com/?p=21426</guid>
		<description><![CDATA[
<p>WordPress custom fields&#8230;what are they? How do they help you? If you&#8217;re not a developer, you might not be familiar with these magical little tools. However, I can almost guarantee that you&#8217;ve used and benefited from WordPress custom fields in your day-to-day WordPress life, even if you didn&#8217;t know it. Here&#8217;s the thing, though: WordPress ... <a title="WordPress Custom Fields 101: Everything You Need to Get Started" href="https://wplift.com/wordpress-custom-fields">Read more<span>WordPress Custom Fields 101: Everything You Need to Get Started</span></a></p>
<p>The post <a rel="nofollow" href="https://wplift.com/wordpress-custom-fields">WordPress Custom Fields 101: Everything You Need to Get Started</a> appeared first on <a rel="nofollow" href="https://wplift.com/">Learn WordPress with WPLift</a>.</p>
<img src="http://feeds.feedburner.com/~r/Wplift/~4/KY3T-r-sPRQ" height="1" width="1" alt="">
]]></description>
				<content:encoded><![CDATA[<p>WordPress custom fields&#8230;what are they? How do they help you? If you&#8217;re not a developer, you might not be familiar with these magical little tools. However, I can almost guarantee that you&#8217;ve used and benefited from WordPress custom fields in your day-to-day WordPress life, even if you didn&#8217;t know it. Here&#8217;s the thing, though: WordPress ... <a title="WordPress Custom Fields 101: Everything You Need to Get Started" class="read-more" href="https://wplift.com/wordpress-custom-fields">Read more<span class="screen-reader-text">WordPress Custom Fields 101: Everything You Need to Get Started</span></a></p>
<p>The post <a rel="nofollow" href="https://wplift.com/wordpress-custom-fields">WordPress Custom Fields 101: Everything You Need to Get Started</a> appeared first on <a rel="nofollow" href="https://wplift.com/">Learn WordPress with WPLift</a>.</p><img src="http://feeds.feedburner.com/~r/Wplift/~4/KY3T-r-sPRQ" height="1" width="1" alt=""/>]]></content:encoded>
			<wfw:commentRss>http://www.wpwife.com/technical/wordpress-custom-fields-101-everything-you-need-to-get-started/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="" length="0" type="" />
		</item>
	</channel>
</rss>
