You’re getting there! Couple of issues – you need to actually grab the latest posts before you can work on them. And post_title
is not a property of the ID, but the object itself:
if ( $posts = get_posts( 'numberposts=1' ) ) {
$title = $posts[0]->post_title;
// carry on sir
}
Note: Ensure you have define( 'WP_DEBUG', true )
in your wp-config.php
when developing on WordPress – it will help immensely with debugging!
Related Posts:
- Changing title of a page dynamically from within a plugin
- WordPress Plugin Development In MVC Architecture, How?
- category_name not working (not showing up in sql query debug)
- What happens when two plugins have the same 3rd party class included into them?
- add_rewrite_rule, plugin activation and plugin deactivation
- Update Multiple Post Meta for the Same Post In One call?
- Allowing Custom Capability to Manage Plugin Options
- wp_insert_user – how to send verification email before logging in
- Custom plugin settings: clicking “save changes” does not display success message
- WordPress Hook that will run when media file deleted
- Get the current taxonomy product category title in woocommerce
- Custom Post Type causes Page Not Found
- Detect if a plugin was included in a certain page
- How can I make the “Preview Post” button save and preview in the same window?
- Admin page: form with enctype=”multipart/form-data” does not transfer its data
- how to load tinymce external plugin
- Organising the plugins folder in wordpress
- How Can I Pass the Shortcode’s $atts Variable to the Plugin’s Javascript Function
- Weird problems after recovery from security breach
- Reset WordPress website
- Is there any way to get all the name or slug of template parts used in a page?
- how an array index could be a file path
- How do i login when i cant access wp-login.php?
- Problem converting tags to categories while having large number of tags
- Color java code the way it is colored in eclipse [closed]
- What is generating my meta og:description?
- Certain actions failing when run through cron
- How do you allow users tag a photo
- Updating the Drag-To-Share eXtended share URLs?
- Send Custom welcome email to specific user group
- install robots.txt to wordpress website admin
- Send Contact form 7 data to remote server using .NET api [closed]
- add_action in static class [closed]
- Automatically populate title field
- register_settings callback function posing problem
- Will these plugins work with wp multisite?
- Sync User to cPanel webmail?
- get gravity form ID from backend/wordpress admin
- Namespaced shortcode?
- What exactly happens to function argument availability when using a filter?
- Repeated Output in Widget
- Changes not visible when not logged in
- How retreive saved data from gravity forms in my template?
- Api external with wordpress
- Redirect Plugins.php to New Plugin Page
- Need to revert to an older version of wordpress
- How to add an extra, independent set of custom fields?
- Making the ‘add to cart’ button redirect to PayPal
- Is it possible for a plugin to prevent certain plugins from being installed?
- Activate a plugin via a SQL query
- When I click on Add Product in woocommerce plugin, I get a blank white page [closed]
- Facebook and Twitter share buttons not working [closed]
- WordPress search shows protected content
- Change Dashboard URL from wp-admin to wp-admin/index.php
- How to customize maintenance mode notification in wordpress?
- Set Button in PluginDocumentSettingPanel Content (WordPress Gutenberg)
- Disable recpacha for contact form 7 specific form
- What is com_jce
- Cant create table on plugin activation
- Trouble with AJAX using GET
- Why is my shortcode not working?
- Custom Rewrite Rule Removing Query String
- Critical Error after Updraft Restoration
- Link custom post type to page
- How to get Angular app working in WordPress plugin?
- ” tag is changed to ” when configuring Cookie Notice
- How to add specific posts to specific pages in WordPress?
- added code to permalink (URL)
- Why is my custom taxonomy image not displaying?
- How to order blog posts by no. of likes?
- Set Content-Type header in do_parse_request filter
- cURL do not mimic click
- What action or filter can I use to change all the html returned from server for a page?
- how to show Author group not Author name
- How can I display a list of only categories which are marked as ‘featured’ in the backend?
- Unexpected plugin_dir_path Output
- Plugin install error: Installation failed: The package could not be installed
- How can I make my plugin display custom post meta data on the front end?
- Which WordPress version to use for improved plugin compatibility? [closed]
- WP_Filesystem usage within a block of code
- Convert HTML5/CSS3 site to WordPress Theme (need a lot of plugins) or just use the API?
- Extending the “Add Media”-Dialog … how do I finally insert something to the Post?
- How can I retrieve data within my widget
- Incentive theme – Getting ’You do not have sufficient permissions’ while trying to install plugins
- What tool are available in the wordpress API for debugging a plugin?
- Metabox Data not saving
- In my plugin when i call select page is blank
- Including a PHP file via a function that is part of a plugin?
- Twitter List Tweets and Delicious Links as Posts
- Overriding FB Auto Connect plugin function displayed in footer
- Replace all media (images)
- Integrate Razorpay quick payments plugin with contact form7 plugin
- Trying to disable all notifications except for one on woocommerce checkout page with css [closed]
- How I can hide my wp folders from Inspect Element (Developer Tools)
- How to Find WordPress site has backdoor login Codes
- WordPress woocommerce shipping order [closed]
- List all posts in a particular page [closed]
- How to add product author carousel in wordpress? [closed]
- Meta box not displaying on the plugin page
- public custom posts not showing in my wordpress plugin