Thing is, the code can go to many places. For me, personally, is to develop own plugin and add code there.
If you need to something execute at certain point, use add_action hook.
From what you wrote, this question might be helpful: add_action hook for completely new post?
Related Posts:
- How to loop over custom fields in a page template?
- Print html when custom field has value inside while loop
- How can I add extra word in permalink when someone click download button?
- Show ACF field with link to ultimate member profile/WordPress user profile below the post (single post layout)
- WordPress loop by meta key that is an array? and how loop multiple arrays
- Products listing check if meta checkbox is checked
- divide custom field values in div every two values
- How can I put a custom field as the link of a button shortcode?
- I want to show image from custom field image on my custom page template
- fetch from an external api call and display results in page
- How to update custom fields using the wp_insert_post() function?
- Adding custom input for data attribute in insert media modal
- Custom Meta Field – Youtube embed
- Displaying post per day
- Guidance with The Loop for CMS
- How to add active class to custom menu using while loop and wp_list_pages
- Update WordPress Custom Field with AJAX on cached page
- Post from one loop in different containers?
- Custom Loop Pagination on WordPress
- delete an array element when its date expires
- User Defined order on get_categories?
- How to Explode a Textarea Field and Echo each line separately, wrapped with HTML
- When would you use $_post instead of $post?
- How do I display the function the_content in this loop?
- Must Use Plugin Causing Query Error
- How to get to a specific position in wp_query?
- Advanced Custom Fields: Post Object – Not returning data [closed]
- Facebook “like” open graph meta in header.php
- Sum custom field values of particular taxonomy
- Importing hard coded custom field into acf field
- How can I add multiple ‘tax_query’ arrays via a loop?
- Using foreach loop breaks
- Loop with slider (slider not loading)
- How to hide all child pages with post_query?
- How to sort posts based on the value (number) of a post’s metadata?
- Firing schema via code in functions.php doesn’t work
- Displaying Woocommerce Product Category in WordPress
- Seach custom post type posts only by meta fields?
- Blog posts repeat
- Woocommerce : Can’t get product info in loop
- conditional logic for front-end custom field edits
- Automatic Shortcode Creation with Custom Fields [closed]
- How would an if statement surrounding a custom field with two variables (holding values) look like?
- Changing the_posts_navigation() html output
- WP_Query fails despite having 1 post
- Loop stopped working
- How to check if a PHP string is different than meta field?
- How to loop through all the attached images in a post, and get their url one by one
- Why does this update_post_meta function not delete the custom field itself?
- Store post content in a php variable and output them using for loop
- Only show image from custom field when present
- Show recent posts starting at a specific number archive
- Hide Heading if ACF Field is empty
- How to get the last category name of a child category?
- Custom meta box values are not getting saved for my custom post type
- WordPress query undefined offset in loop
- WP_Query: getting posts where custom field exists
- Issue with custom loop in Archive page
- Creating an image from a custom field
- User Meta Value not echoing despite Var_Dump Showing correct string
- WP Query Leads to 502 Bad Gateway (Timeout Because Query Takes Too Long)
- home.php show blog posts as grid view
- Unable to render custom field after attempt to generate a list of recent post in page template
- WordPress call post-ID in jquery
- How to extract information from a wp_query result?
- List all anchor links on a page
- Conditional On custom field plugin metabox
- Meta boxes only displayed when editing normal (default wp post_type) posts
- WordPress stripping out custom field tags
- Using an “IF” statement based on the existence of custom field
- Woocommerce Custom Meta Boxes- How to only display if they actually have content
- How do you save the values from custom fields to a products data
- Is it possible to update the dataset using update_post_meta
- update_user_meta as multiple value but with same meta key
- Responsive loop with 3 columns inside row then 2 columns
- What is the correct way to search 3 custom fields only in WordPress?
- wp_get_nav_menu_items() with ACF
- How do I get the value of a current user’s custom field?
- How do if all posts has this category ID then do this
- ERR_TOO_MANY_REDIRECTS / To Force SSL Logins and SSL Admin Access
- View tag description on page
- WordPress loop add heading before first of type
- Insert div after every three posts in home.php [duplicate]
- Custom fields changes the formatting of metabox input
- Display product attributes for current product
- Display Content Based on Custom Field Value
- Custom field in title
- How to have post count after each listed category
- Transient Loop Not working as expected
- I want Page titles and excerpts to show up on home.php in certain order
- Conditional in foreach loop is outputting content twice
- is there away to hide php code in wordpress not to show in PAGES
- Grabbing value of input field inside of array
- How can I change the location where the custom field is displayed in the Quick Edit tab in WordPress
- How do I exclude the current post from the upcoming post query
- How to create advanced custom fields for backend content
- Exclude function for custom pages, exclude custom ACF fields
- When a foreach loop is used multiple times in blocks, is there a way to ensure a variable always has a unique value?
- Custom theme on multisite has issues with standard loop output
- How to get the post title inside a custom block in a loop? block.js