Skip to content

Commit 4eecb51

Browse files
committed
Add a constant to easily change the max number of images to be included in the OpenGraph meta tags.
1 parent a36a347 commit 4eecb51

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

opengraph.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Description: Adds Open Graph metadata to your pages
66
* Author: Will Norris & Matthias Pfefferle
77
* Author URI: https://github.com/pfefferle/wordpress-opengraph
8-
* Version: 2.0.1
8+
* Version: 2.0.2
99
* License: Apache License, Version 2.0
1010
* License URI: http://www.apache.org/licenses/LICENSE-2.0.html
1111
* Text Domain: opengraph
@@ -21,7 +21,8 @@
2121

2222
// Disable strict mode by default.
2323
defined( 'OPENGRAPH_STRICT_MODE' ) || define( 'OPENGRAPH_STRICT_MODE', false );
24-
24+
// Set the maximum number of images to include in Open Graph metadata.
25+
defined( 'OPENGRAPH_MAX_IMAGES' ) || define( 'OPENGRAPH_MAX_IMAGES', 3 );
2526

2627
/**
2728
* Add Open Graph XML prefix to <html> element.
@@ -928,7 +929,7 @@ function opengraph_max_images() {
928929
*
929930
* @param int $max_images The maximum number of images to include.
930931
*/
931-
$max_images = apply_filters( 'opengraph_max_images', 3 );
932+
$max_images = apply_filters( 'opengraph_max_images', OPENGRAPH_MAX_IMAGES );
932933

933934
// Max images can't be negative or zero.
934935
if ( $max_images <= 0 ) {

readme.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
- Tags: social, opengraph, ogp, facebook
55
- Requires at least: 2.3
66
- Tested up to: 6.7
7-
- Stable tag: 2.0.1
7+
- Stable tag: 2.0.2
88
- License: Apache License, 2.0
99
- License URI: https://www.apache.org/licenses/LICENSE-2.0.html
1010

@@ -63,6 +63,10 @@ The plugin populates the meta 'name' attribute alongside the 'property' attribut
6363

6464
Project maintained on github at [pfefferle/wordpress-opengraph](https://github.com/pfefferle/wordpress-opengraph).
6565

66+
### 2.0.2 (Feb 25, 2025)
67+
68+
- Add a constant to easily change the max number of images to be included in the OpenGraph meta tags.
69+
6670
### 2.0.1 (Dec 16, 2024)
6771

6872
- Fixed a warning

0 commit comments

Comments
 (0)