You have two problems in your code.
- You use
$post
as a iteration variable which is an habit best avoided - You use
setuppostdata
which changes the global$post
without you using any function that actually needs it
your loop should look like
foreach ( $pp_query as $p) :
$pointer_query[] = array(
'id' => get_post_meta($p->ID, '_sbap_pointerid_text', true ),
'screen' => get_post_meta($p->ID, '_sbap_screen_text', true ),
'title' => get_the_title($p->ID),
'content' => get_the_content($p->ID)
);
endforeach; endif;
then the reset_post_data
is unneeded as well
Related Posts:
- Should I use spl_autoload_register() in my plugin?
- error_log() output for print_r() appearing on page
- When to use Exceptions vs Error Objects vs just plain false/null
- Custom plugin: Trying to show saved data on frontend
- Why when I instantiate wp_error in a validation method my user registration method stops working?
- How to find error in my code when the error message is pointing to WP core file?
- “Undefined index” error when saving empty array with checkboxes
- I am having errors with checkout on wordpress
- How to send logs to plugin owner for a plugin?
- How to set and use global variables? Or why not to use them at all
- Where to get information about array fields in $_REQUEST?
- WordPress URL Rewrite not working
- Display a text message if the shortcode is not found?
- simple wordpress ajax plugin not working when not logged in
- Filter the blog title displayed in the header
- Saving metabox repeatable fields
- Notice: Constant already defined in wp-config.php on (non-existent) line?
- how to create and show sessions in word press?
- Error when requesting password reset email – wp authentication
- do not show web page section when using advanced custom fields pro
- How to get all existing post types
- New Plugin Review
- Create custom blocks for bootstrap
- Query String being Removed Creating a Pagination Issue within a Custom Plugin
- wp_insert_post() is returning the correct post ID, no failure, but the post content does not get updated
- WordPress Scheduled Event Request Blocking
- PHP Fatal error: Uncaught mysqli_sql_exception: Table doesn’t exist in wordpress/wp-includes/wp-db.php
- How to set up VS Code for WP plugin/theme development in 2021? [closed]
- Saving an array of dynamic repeater data as post_meta
- WordPress wpform plugin submit and get multiple checked value from checkbox [closed]
- Improve page speed loading using CDN and async or defer attribute
- A non-numeric value encountered in /wp-includes/functions.php on line 68
- Script to browser problem PHP
- Store a default value for a transient on plugin activation
- wp query foreach deleting record returning only first or last item
- PHP > Scheduled Tasks > Sending daily email with dynamic API variables
- WordPress Custom field Colors
- Getting error when using wp_insert_post()
- Is it save to use eval for a jQuery callback method coming from the database?
- Warning: Illegal string offset on theme options page [closed]
- Scheduling an event inside plugin class is not working
- How to Change CSS Colors from Custom Plugin Settings Page
- Passing the name of selected color from the custom component to `render_callback`
- Any ideas why I am getting “I’m getting “wp-admin/admin-ajax.php 401 (Unauthorized)”
- Cant register rest routs from class instance
- wordpress frontend editor to add extra css to website
- Action Hook Inside WordPress Plugin Shortcode
- PHP: How to access db the right way in plugin?
- select a single val though a table in wordpress
- Help with accessing wp-admin page and resolving error messages
- Blog suddenly shows Archive instead of index page
- WordPress – Get Posts with Category data
- How to use wp_send_json() and output the value with ajax?
- Problem with inserting multiple images in gallery of each WooCommerce product programmatically
- Is it possible to access admin-ajax.php using PHP?
- Call to “admin_notices” hook from a static method
- How to Create custom block for displaying information in content section which act like shortcode
- How to detect and handle the time difference between server and user in WordPress?
- How to setup the Email piping in WordPress plugin?
- Reliable way to add nonce to HTTP Header in WordPress?
- Getting an error when my plugin is updated, but the files update correctly
- Creating a POP Alert
- Custom global variable not working in function
- ssl redirect function is not working
- WordPress Plugin Development – get_option error
- how to add new PHP page in WordPress plugin
- How can I get my WordPress plugin to receive data and relay it in an ajax/php request to a remote server that requires authentication?
- code that I can run, or a plug in to show what sql tables something pulls information from
- Automatic email message after manual user approval
- Trying to get property ‘ID’ and ‘post_author’ of non-object error
- Constant expression contains invalid operations plugin class properties visibility
- Gutenberg blocks shortcodes compatibility
- Enqueue sripts and styles only if function is called
- Add widget area from visual editor
- Save custom field on WP_List_Table
- Load script and styles using an array of resources
- Register/enqueue scripts only on certain admin pages
- Looping through custom data in a custom table to display all items in a post
- Site title not showing. Please help me
- PHP Error in WordPress Theme
- WordPress database error only while loading page for 1st time
- Input field duplicates on form submit by jQuery
- Unable to pass variable to database
- INCOMING: Wall of code for form and $_POST, not updating custom field’s value
- add shortcode heading showing multiple time
- WP multisite network plugin fails to see classes loaded with spl autoload
- WordPress won’t display errors at all
- Troubleshooting “loopback requests that take too long”
- AJAX & PHP | Call a specific PHP function from a PHP file via AJAX?
- What is this mark for “? function()” [closed]
- Query Concatenation
- WordPress White Screen Error
- Suppress errors when using global function
- using a shortcode in a hyperlink
- Import js variables loaded via wp_localize_script() into js module without global scope connection
- Custom taxonomy with page post type – WordPress
- Query posts by custom taxonomy slug in WP REST API?
- oneOf JSON Schema validation not properly working for custom post meta value?
- Too few arguments at registering new templates in my plugin
- I want to lists posts in wordpress to nearest location entered by the user