“Custom Field” to Excerpt field” for pages? [closed]

You have gaps in your knowledge of how data is structured in WordPress. In WordPress all pages/posts etc are ‘posts’ and have a type.

For example:

  • ‘post’ posts are blogposts
  • ‘attachment’ posts are images/videos/audio/uploads
  • ‘page’ posts are pages

Post types tend to have their own section in the menu on the left of the admin interface. You can add your own too, search for custom post types for how.

In the code you referenced there is a query that grabs all the posts of a certain type, so that it can then loop over them and fix each ones excerpt. It does this by specifying a post_type of ‘post’ for standard blog posts/news:

'post_type'   => 'post'

This needs to change to the page post type if you’re wanting to use it on pages.