This should work:
$args = array(
'post_type' => 'attachment',
'numberposts' => -1,
'post_status' => null,
'post_parent' => 0
);
$attachments = get_posts($args);
if ($attachments) {
foreach ($attachments as $post) {
setup_postdata($post);
the_attachment_link($post->ID);
}
}
Related Posts:
- dbDelta not creating tables
- How to fork a plugin?
- Default table collation on plugin activation?
- How to implement color picker from wordpress in my plugin?
- Nonces can be reused multiple times? Bug / Security issue?
- Single Responsibility Principle and WP Classes
- How to auto-upgrade my plugin?
- How to Add a .js file Only in one specific Page Dynamically to Head
- Displaying search results in the widget itself?
- Missing “category_children” option when dynamically creating categories via a plugin
- Developing a plug-in to charge for
- How to exclude content (and other returned values) from WP_query()?
- Looking for callback function after Gutenberg is rendered?
- WordPress select dropdown list in widget
- How to duplicate a curl XML request using HTTP API?
- How to assign a WP 3.0 custom nav menu to a theme’s navigation menu location via script?
- how to include javascript file and css file in wordpress
- Order properties should not be accessed directly
- How to avoid loading same script twice?
- Is there any way to check for user login and send him to login?
- Can I individually style items in the backend widget list?
- Is using WP Transients to save external data for a plugin the best/right way?
- Why is my javascript not invoked in my hooks except wp_head?
- How to Create database table when Plugin installed/activated, and delete database when Plugin deleted
- include wp-blog-header not working on MAMP
- Backbone event attachment:compat:ready can’t hook
- Add a class to a dynamic sidebar’s wrapper
- WordPress database error for query INSERT INTO
- How to connect to AWS RDS external database (not for the core WordPress db)
- Issue regarding $wpdb->prepare()
- Checkbox Undefined index error in Plugin
- Change the look and feel of admin pages
- how to search users by ajax live search
- Generate JSON files for language translation from po file without wp-cli i18n make-json
- Detect front-end pages only in init hook
- Display WordPress the_content() via data attributes
- Constraints in custom tables for plugin development – Yes or No?
- Run Shortcode of post’s custom field in functions.php / Plugin
- Settings API with arrays example
- Creating Admin Plugin – Content of a page is displayed at global scope as well
- load_plugin_textdomain doestn’t work with add_action plugins_loaded
- add_rewrite_rule behaving strangely
- Problem with context in multisite – getting main site data in every blog (get_pages())
- wp_get_post_terms Order by not working
- Naming conventions when using (PHP5) namespaces?
- Readme.txt seems to be cached but not the version
- Issue on Checkbox with Custom Option Page
- change add to cart button link [closed]
- Encoding Method for URLs?
- Store custom meta box data as serialized array
- Using Product variations as product addons
- configuration of .htaccess for add_rewrite_rule to make sense
- Change author permalink to external URL
- How to get post meta in functions?
- AJAX request not routing through proxy
- Plugin access to average users not only admin
- Custom Settings Plugin Save foreach checkboxes
- Rewrite not working since upgrade to 5.9
- Why won’t this submenu page show? – My First WordPress Plugin
- wordpress full site editing problem when extending core blocks
- How to check if `comment_meta` exists before inserting the comment?
- Can display plugin without shortcode?
- Multiple dynamic Tax Query – pass taxonomy argument from array
- Add default custom taxonomy to plugin activation
- ACF Field value in wordpress login message filter
- ajax stopped working when not logged in wordpress
- Hook for validating and rejecting frontend image upload
- Overriding the template files using a plugin for all themes
- Woocommerce product not appearing in category list page when created programatically [closed]
- Plugin removes itself if mistake made during edit
- Using meta_key & meta_value in add_rewrite_rule
- implementing socket.io with wordpress
- Can’t create a blank template
- Custom Registration Form and Passwords
- Determine if the current page, is being edited
- List Table action argument not cleared
- Fullwidth slider using background image Flexslider WordPress
- Return value of $wpdb->update() query in plugin is wrong
- Is there a way to tell if a shorcode’s handler is being run before or after the content formatting filter?
- Plugin files not updated (cache cleared)
- How to limit the number of posts a user can view based on status
- WordPress permalink setting
- How to create an embedded code for wordpress shortcode?
- Error when trying to save custom post type settings (ERROR: options page not found)
- Developing a plugin, ran it through P3 Profiler, shows up slow, but I don’t know why
- Dynamic banner for use on external sites
- How to add additional field in a table row after creating a table?
- WordPress plugin tables become corrupt
- How to call a new php page inside a plugin page?
- How can i call from custom fields to the category editor?
- Practical Solutions to HTML5 Video on WordPress
- Is it possible to convert various image types from remote URLs to WebP and then serve them immediately?
- If I want to create new taxonomies (e.g. Project / Documents / Etc…) is it better to create them in the theme’s functions.php or within a plugin? [duplicate]
- Is the only way to add taxonomy terms via an admin panel?
- Checking if the query is empty does not work
- Remove default wordpress roles
- What is the meta_query key name for the woo product average rating? [closed]
- how to catch a data from a array in WordPress
- Why my admin-ajax url returns 0 even after adding echo and die() at the end of function?
- External api call using wordpress