You need to use a hook and a function in your plugin file.
For example:
function sher_posts() {
$pages = get_posts($args);
foreach($pages as $page) {
$out = get_permalink($page->ID);
}
}
add_action('wp', 'sher_posts');
Of course this example doesn’t know what $args are or what to do with $out.
Related Posts:
- Manually set global $post vars with an ID, in order to use template tags
- How to not allow users to create new tags, but allow to them to use existing ones
- Gutenberg disallow certain custom blocks but keep all core blocks?
- Publish author posts only with editor approval?
- Limit access to posts/pages by user roles
- Remove Google Fonts Which Are (Probably) Added By Plugins
- Customizing subject in comment notification e-mails
- Common functionality between my own plugins
- WP showing “warning: call_user_func_array()”, What to do?
- Adding a text domain to every __(), _e() and __n() gettext call without a plan to create own translations
- Declare a function before plugin does on the theme functions.php file
- Editor access to plugin settings
- Saving Plugin settings to the database
- Shortcode display outside the div
- Removing user contact methods works from functions.php but not from a plugin
- Custom Widget outputs the input but doesn’t save anything inside the textarea
- Use functionality of 2 wordpress plugins
- How can i change an image’s author?
- Can wp_script_is used in pluginA check if a script is being enqueued/registered from pluginB?
- Set WordPress Featured Image For All Post Slugs Matching Image File Name in Specified Directory
- Showing Co-Authors on post page
- Where to place custom functions?
- WP Job Manager Category Drop-down; Change Placeholder Text Via Filter
- Redeclare theme’s function in a plugin
- AJAX button run function
- Change wordpress current_time function to different timezone
- How to override a plugin function wrapped in a class?
- Snippets: is it better to add them in functions.php or make site-specific plugins?
- Display post lists in 2nd paragraph
- Restrict media upload size by format
- How to display custom sidebar in wordpress 5.5.2
- creating html reusable blocks via shortcodes
- Replacing a plugin function with a custom renamed function doesn’t work
- Facebook Messager Plugin
- Fatal error: Call to undefined function cmsms_theme_page_layout_scheme()
- Disqus deleted comments are syncing with wordpress but active comments do not
- Ajax : Call undefined function plugin_function() … can’t call any plugin function
- bbPress plugin: forum lists not showing in correct order? [closed]
- How to create an option page for this simple plugin
- What is @Action in WordPress?
- Is there a best practice remediation for PhpStorm’s warning that void function the_post_thumbnail is used?
- the_tags : can we insert a class
- How to over-ride a file in a plugin? [closed]
- Overwrite category head title
- execute function after one completed
- How to reset the plugins without deactivate the plugin
- plugins_url() works everywhere but wp_reqister_script()
- Adding class to last list item? Not WP generated
- Replacing global wp_query
- I changed .live() to .on() but change is not reflected on the server
- wp_enqueue_scripts
- How to get specific string/value from an array? php [closed]
- WordPress Stock Update Programatically
- 5 PHP Fatal error: Uncaught ArgumentCountError (Cannot Find)
- Getting a ressource ID, from a WC_Order_Item_Product/Order
- same user role or copy the user role to be same as the other role
- Changing plugin options from theme functions file?
- Could not add ‘LoginLogout’ link using BAW login logout plugin
- My widget won’t update its values when save is clicked
- Execute a function when the entire page is displayed
- How can i listing current category and Featured Category post list?
- How to add custom function to pluggable.php
- grab or load text on demand
- sliding/fading header plugin or approach suggestion
- Replace the_content with ACF Flexible Content via function
- How would I get the new plugin version on this function?
- Create category for each user
- Is there any way to sync Facebook Comments and with comments on WordPress website?
- Search in WordPress
- post id or permalink auto-incrementing number and reset everyday
- Modify function output in a plugin
- Is admin section completely customizable in terms of styling?
- How to make the first letter of a post title uppercase, in a plugin?
- Get a Taxonomy values in an array
- Migrating custom php we wrote from functions.php into a site-specific plugin
- Place content inside the Post Loop
- How to replace native comment_count with Comments Evolved aggregate count
- Hook into install email
- wordpress Shortocode running twice?
- Is there any wordpress function to update a random post every 10 minutes?
- Calling an custom field from theme option at the frontend
- pluggable function in theme, to be overridden by plugin
- How to add submenu to WordPress plugin in the same Directory of main Plugin?
- Calling a function from a link in WordPress
- Saving an array to get_options
- Contact Form 7: custom validation [closed]
- Showing author box on post detail page
- add query string to all pages after user logged in
- Simple WordPress function / plugin to redirect a site
- Remove base from the custom post type URL [duplicate]
- is_plugin_active() not defined on active plugin, in the thumbnails.php file
- How to declare this function correctly?
- Requires PHP version 5.3.0
- PHP if url extension action=discussion condition use [closed]
- Make plugin admin page visible to other roles
- Show WooCommerce products based on query parameters on redirect
- Read page- or post-content across different builder-plugins
- Secure way to add JS Script to WordPress filesystem
- How to get next day date of a specific day
- How to access a function declared in child theme’s functions file in a plugin file?