You have extra spaces around change_posts_order
, inside the quotes:
add_action( 'pre_get_posts', ' change_posts_order ' );
PHP can’t find a function with that name, because wits looking for that function preceded with the spaces. Remove the spaces to fix the issue:
add_action( 'pre_get_posts', 'change_posts_order' );
Related Posts:
- Best practice custom function, where to echo the variables?
- How to delete taxonomy term when a wordpress user is removed?
- How to filter, restrict and return posts based on custom user meta information
- Is it possible to completely stop WP_Query retrieving posts?
- Hook/action after WP_Query gets posts to query custom tables for post-related meta
- ajax category filter
- WordPress 4.9.5 PHP intermittent warning trim() expects parameter 1 to be string, array given
- Want to redirect if search query match exact title of any post
- Overriding The Loop with filter or hook
- new WP_Query() – what is the earliest valid hook?
- Identify which loop you are hooking into; primary or secondary?
- Pagination custom query
- Order by two meta keys
- Finding all results from database within 500 miles of the given latitude and longitude [closed]
- Function to check if author has posted within the last x days
- Shortcode returns escaped HTML tags
- Calling a custom excerpt function in a local loop
- How to get any tag ID
- Dynamically Override Fancy Title – Part II
- query posts in functions.php and update a field
- Get posts using WP_Query
- Finding post content that begins with a specific character
- How to get user_id from wordpress database inside ajax function?
- Gravity Forms field entries into wp_query loop [closed]
- How to change posts order on Category and Tag archives?
- posts_per_page not working
- is_search was called incorrectly
- Exclude admin from WP_Query Contributors
- Multiple Loops Inside a Function
- How to choose between hooking into per_get_posts or into parse_query
- How to use filter hook “the_posts” with a function that refers to $this?
- Exclude category for main query and custom
- Display posts from only one post form in custom query and exclude in main query
- Category applied to pages, creates multiple breadcrumb entries after a search query (On the translated site)
- How to use the query hook/filter?
- WP Query using tax_query & meta_query
- Set global $wp_query/$post variable for dynamic page generation
- wordpress search word, “hello world” ===> ‘hello+world’ ===> ‘hello’, ‘world’
- Display most popular in the past two days
- meta_query not working as expected
- New WP_Query calls Pre_get_posts filter twice
- how to access query string in wordpress?
- How can I override one post and make it display content for another post?
- Merge two search functions for custom post type
- Make a SQL query with wpdb in WordPress
- how to use pre_gets_posts to exclude one queried ID from homepage loop
- Error with function in functions.php?
- queried_object using pre_get_posts gets notices and warning
- Utilising an existing page while using the “s” query parameter
- Exclude authors IDs from WP_Query
- Loading two different AJAX requests on two different pages
- Getting the post terms ‘wp_get_post_terms’ per post when within the functions.php file
- How to load a script code only in posts?
- Multiple meta_key ordering with pre_get_posts
- How do I fit WP_Query arguments into a function?
- Create a notification for post field
- Add URL Rewrite Rule To WordPress
- Trying to get property of non-object in: $wp_query
- WordPress dynamic AJAX query
- relation OR instead of AND – Filtered term ID’s in loop
- Filter for replacing the WP_query object for a given category
- Elementor posts custom query based on tag [closed]
- WP_Query retuning empty array in rest api
- Pagination repeating posts on search results
- How to check if logged in user have pending custom post?
- Custom WordPress post query for displaying time-released content on website
- Custom query for custom post type not getting correct post ID
- Finding post ID dynamically on click
- how to move a page from one drop down menu to another drop down menu
- How to upload 3 attachments to current post?
- remove_action – pre_get_posts – does not restore original query
- Global page ID variable empty error
- WP_Query & shortcode : Return 3 articles from a category WordPress
- Get post Number with local loop and template
- Save query in function for custom gallery
- Seach and categories not working when ignoring sticky posts in main loop
- Problem with custom WP_Query and underlying pagination/posts_per_page
- Calling a function with WP_Query only ever brings the first result
- What argument does my function need to echo get_results() query results
- Rewrite rule pagination on different url levels
- Fetching $_POST from Page Template into functions.php
- Declare inline background image in functions.php
- I wan to process the following js to process the AJAX Request on my function to calculate author Total Post views
- Hiding all posts/products/pages from a site based on a custom taxonomy/domain name
- ordering and optimizing functions
- $wp_query when new WP_Query
- Why WP_Query in functions.php is not working when get_posts works?
- Adding css tweak based on page template
- WP_Query and DES sort for Custom Taxonomy based upon a meta field?
- How to write a query-function as a query-shortcode?
- 1500+ duplicate queries via get_option function (query monitor)
- Variations as Single Products [closed]
- Excluding a category from frontpage but not from WP_Query
- Prevent WordPress loop from displaying similar post titles
- Custom WordPress loop, articles not in same order as Array
- Group By query based on Custom Field
- delete_term is not working properly with add_action()
- Limit paginated result set to a maximum number of posts
- Custom query with custom filtering returning incorrect results
- Best performance for use Custom Field in WP