Social media tools use open-graph meta tags to decide what image to display when you share a post or a page on their network.
By default, if you set a featured image to a page/post, that will be shared.
If you want to change that image, you can use plugins like RankMath SEO or Open Graph, which will have priority over the featured image.
Using the RankMath SEO plugin
Go to WordPress Dashboard → Plugins and install the RankMath SEO plugin.
Edit the page or posts for which you want to change the Image displayed when the page or post is being shared on social networks.
Click on the RankMath options (at the top right corner).
Click on the Social icon.
Click the Add Image button, then upload or select an image from your WordPress Media Library.
Note: The size of the image used should be at least 600x315px. The recommended size is 1200x630px.
Using the RankMath SEO and the Visual Builder
Open the page/post for which you want to change the Image displayed when the page or post is being shared on social networks in Visual Builder.
Click the RankMath icon.
Click the Social Media tab.
Click the Add Image button.
Using the Open Graph plugin
The Open Graph WordPress plugin is a good alternative if you prefer a much simpler solution.
Go to WordPress Dashboard → Plugins and install the Open Graph plugin.
Edit the page or posts for which you want to change the Image displayed when the page or post is being shared on social networks.
Click the Upload/Choose button.
Upload or choose the image from your WordPress Library.
Note: The size of the image used should be at least 600x315px. The recommended size is 1200x630px.