You’re using an old version of WordPress. Upgrade to 3.5 and you will no longer see that error.
Here’s the function declaration for get_post
in WP 3.4:
function &get_post(&$post, $output = OBJECT, $filter="raw")
Notice the ampersand in front of $post
? That would mean the value is passed by reference. You can give the function a literal, it has to be the variable.
The correct solution is to update to WP 3.5 (we’re on 3.5.1 at the time of writing). Get post to WP 3.5+:
function get_post( $post = null, $output = OBJECT, $filter="raw" )
The less good way is to simply cheat when you call the function and do an assignment + call at the same time:
$a_post = get_post($a_post_id = 439);
$a_post_id = 439
in the function arguments creates the $a_post_id
variable and pass it into the function.
Related Posts:
- Get post by Category in custom template
- How to get permalinks with category base working with sub-categories
- WP 3.9 TinyMCE no longer loads on category description editor
- Change Gutenberg category checkboxes to radios
- Checklist of selected categories
- Multisite – Protect categories from deletion?
- Exclude categories from search query
- Why is per_page not working with categories in WP API?
- How to order the get_categories result
- List posts by category exclude current post
- How can I calculate the total number of categories at different hierarchy levels?
- In the tag archive – display count of posts for each category they belong to
- Display only deepest category on a single post?
- Custom color for each category name
- Listing all posts from current category on page
- Show posts of one category only with Custom Taxonomy on single.php
- Wrap a chosen category name with div
- Hide uncategorized products from the shop page
- wp_list_categories() – adding a div to each li?
- Listing Parent, Child and GrandChild Categories and then the PostTitles on Page Template !
- How Can You Exclude Categories From Your RSS Feeds?
- Help with multiple dropdown tags search
- Category tree is flattened inside admin upon saving
- Get woocommerce catogry
- weekly archive for custom category
- Get last post date yesterday from each categories not work & double result post
- ?cat=-1 Indexed Versions Of Homepage
- .htaccess too many redirects based on category slug
- Multiple categories PROBLEM and Duplicating main categories
- How get permalink for the current category or tag?
- using checked function to verify value against an array
- wp_list_categories depth and number
- Category index featured image
- Order categories by most posts
- Exclude category from fucntion
- Get Unique Categories – Group By?
- How to redefine the sorting of product categories by menu_order?
- Filter Categories in meta box for CPTs
- Site search needs to find posts for category topic AND Tag or keyword thats not in the post
- Custom archive.php: retrieve right post categories?
- Add category only if post has custom taxonomy category
- Restrict author to create subcategory in a selected category
- categories on attachment page
- A single category with a specific permalink structure differing from the standard set for the rest of the site
- List only child categories within posts
- Admin comments and user restrictions
- category url structure
- How to conditionally hide author name on Single.php if category is “news”, otherwise if category is something else display author name?
- How to restrict user to choose 1 category for a post
- Different Output for “Every Other” Foreach Statement?
- Failing in_category or has_category in the_content_feed
- get_posts ignoring ‘category’ and displaying all posts
- How to change the thumbnail size to a specific category?
- Get paged category link programmatically
- Is it possible to have a template that works on multiple categories where the link address contains the specific category?
- Display list categories from CTP
- display a link to all the categories of current post, including parents
- How do order product categories – on a parent category page – in Woocommerce?
- Display only subcategories of a category and not sub-subcategories
- Latest updated categories list query, exclude one from displaying
- category link not working for a specific slug, works for others
- Shows only one Category in home page
- Get categories list with category name in custom WP_List_Table class
- Getting parent category hierarchy as objects from category template
- Setting selected term_id with wp_dropdown_categories?
- how can i hide category?
- Placing category specific banner/html at top of respective category pages
- Get parent category field from child category [closed]
- Custom sidebar isn’t showing up on sub-category posts
- Can a Woocommerce product category URL contain “&”?
- How can I display all products from all categories on one page with woocommerce?
- get_the_category return empty inside loop
- Possible to make get_categories() hide_empty attribute honor excludes from post query?
- Function add class to second menu specific items if the page has a certain category
- How to call Primary Category for WordPress Woocommerce
- Meta Box: display single image on an archive-template
- Search Replace Database ONLY for posts of certain category?
- Categories Help and video uploads
- Display only children of custom hierachial taxonomy
- Read More showing only on first post
- Tag Menu items based on their categories
- Filtered post assigned to categories
- How to exclude a specific categogy from a custom page template
- Transfering static site to wordpress and retaining category by month paginations
- Category Templates for Post Types not Working
- Change category base based on category
- altering theme – content generated by PAGES not PORTFOLIO
- Show only one category in main query, issues on tag page
- Bringing Ajax Loading Feature on Category Pages
- Need help with category page customization meeting certain condition
- How do i add custom post types to this query?
- add new input field like category?
- WordPress excerpt for specific posts in category
- Show category-ID in custom category-list
- Dynamically Adding Category Specific Content To Specific Category & Subcategory Pages
- Structure with category setting
- chose category in plugin
- Do not show all post from all categories, just show posts from category in current loop
- How to prevent page re-sizing for mobile browsers [closed]
- Restricted category in Woocommerce [closed]