Articles of custom field

post meta getting deleted on save

I’m having an issue saving post meta on all post types, both default and custom. I’m hooking in to save_post to run my function, and what’s happening is that the post meta gets added, but then immediately deleted. This is what I have right now: function saveSidebarMeta($postId) { $toAdd = $_POST[‘collection-topics’]; foreach ($toAdd as $topic) […]

How to display submenus on page based on referring top-level parent?

I am trying to display a secondary menu on pages that displays all the coordinating sub-pages of the top-level menu item they navigated there from, but my issue is that some pages appear under multiple top-level menu items. Since I know I can’t assign a page to multiple parents, is there a way to do […]

how to set default value for checkbox in wordpress

I am facing a problem to set default value for the checkbox field in WordPress. I have a checkbox input field (metabox) in a custom post. I want the checkbox to be checked by default. and if user uncheck it then it should be saved and unchecked and remain unchecked when page is refreshed. My […]

Custom Fields Code not echoing whats in the value field

Hey friends: I’m trying to use wordpress custom fields that seem like would be fairly straightforward. I’m using Genesis Outreach Pro child theme This code is now located in my function.php file: //* Hook mbr custom shortcode content after header add_action(‘genesis_after_header’, ‘mbr_after_header’); function mbr_after_header() { if ( is_singular( ‘post’ ) ) $cf = get_post_meta( $post_id, […]

How to convert custom field value to tag

I have a site with a custom field (location) on every post . I want to change the value of each custom field value in every article to tag. I tried searching here but couldn’t get much info . Some useful links here: Plugin to auto convert custom fields to tag I’ve tried using the […]

How to Duplicate (multiple meta box)?

I’ve made a meta box field which works nice, but now i need to add one more. For the past few hours I’ve tried to mix every piece of it, to duplicate it, take some parts, google, search, and no luck. Second meta box appears but it wont save. So this is my first meta […]

Keep display metadata value on backend – Custom Metabox

I was trying to add a Custom Post type and a Custom Meta box. Which I’ve done. But I’m facing another problem which is. When I give any value into the Custom Metabox I created its not saving the data on backend. Its perfectly working on Frontend. Now since its not keeping the value in […]

How to add custom fields to admin UI and REST API response?

I am new to custom WordPress development and am learning how to use the REST API endpoints to display post content onto a non-WordPress company intranet site. I have successfully been able to consume standard post data into my development concept which is a list of books listed by title and date. I need to […]

Is there a way to get a file URL from the relationship ACF field?

I have a relationship acf field that displays posts from a custom post type that are then displayed on the front end. The post type is publications and I want to link to the publications uploaded file as opposed to the single page link, how would I do this? Here is the code for the […]

Tweak Meta for Post to work it for Pages also

I’m trying to register the metaboxes for both posts and pages. This code registers meta only for posts. Can someone guide me how to accomplish this? (keeping the fact in mind that i want “LESS IS MORE” code attitude) function add_custom_meta_box() { add_meta_box(“demo-meta-box”, “Option Page to select Page Template”, “klogeto_template_option_meta”, “post”, “normal”, “high”, null); } […]