84% posts-to-posts

Code Review | Posts 2 Posts

WordPress plugin Posts 2 Posts scored84%from 54 tests.

About plugin

  • Plugin page: posts-to-posts
  • Plugin version: 1.7.2
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 6.0-6.3
  • WordPress version: 6.3.1
  • First release: May 9, 2010
  • Latest release: Sep 14, 2023
  • Number of updates: 377
  • Update frequency: every 12.9 days
  • Top authors: scribu (98.94%)stiofansisland (1.33%)

Code review

54 tests

User reviews

99 reviews

Install metrics

10,000+ active /296,747 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.62MB] [CPU: ▲3.88ms] Passed 4 tests

A check of server-side resources used by Posts 2 Posts
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.96 ▲0.5043.31 ▲4.11
Dashboard /wp-admin4.02 ▲0.7249.98 ▲3.86
Posts /wp-admin/edit.php4.07 ▲0.7253.86 ▲9.82
Add New Post /wp-admin/post-new.php6.54 ▲0.6591.72 ▲4.40
Media Library /wp-admin/upload.php3.85 ▲0.6240.13 ▲3.15
Connection Types /wp-admin/tools.php?page=connection-types4.1239.20

Server storage [IO: ▲0.44MB] [DB: ▲0.00MB] Passed 3 tests

Analyzing filesystem and database footprints of this plugin
This plugin installed successfully
Filesystem: 163 new files
Database: 2 new tables, 8 new options
New tables
wp_p2pmeta
wp_p2p
New WordPress options
can_compress_scripts
widget_recent-comments
widget_theysaidso_widget
widget_recent-posts
theysaidso_admin_options
p2p_storage
widget_p2p
db_upgraded

Browser metrics Passed 4 tests

Posts 2 Posts: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,804 ▲5813.65 ▼0.751.64 ▼0.2338.53 ▼5.12
Dashboard /wp-admin2,207 ▲225.85 ▲0.06103.87 ▲3.7539.22 ▼6.65
Posts /wp-admin/edit.php2,096 ▲72.07 ▲0.0739.30 ▲3.7034.14 ▼2.50
Add New Post /wp-admin/post-new.php1,536 ▲323.13 ▼0.11649.63 ▲40.3063.18 ▲11.67
Media Library /wp-admin/upload.php1,392 ▲104.21 ▼0.0097.18 ▼4.7743.09 ▲0.68
Connection Types /wp-admin/tools.php?page=connection-types7632.1925.4727.11

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] 75% from 4 tests

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
The following items require your attention
  • Zombie WordPress options were found after uninstall: 7 options
    • widget_p2p
    • widget_recent-posts
    • widget_recent-comments
    • can_compress_scripts
    • db_upgraded
    • theysaidso_admin_options
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Everything seems fine, however this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Please fix the following items
  • 51× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'P2P_Dropdown' not found in wp-content/plugins/posts-to-posts/admin/dropdown-post.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'P2P_Side_Post' not found in wp-content/plugins/posts-to-posts/vendor/scribu/lib-posts-to-posts/side-attachment.php:3
    • > PHP Fatal error
      Uncaught Error: Interface 'Mustache_Exception' not found in wp-content/plugins/posts-to-posts/vendor/mustache/mustache/src/Mustache/Exception/UnknownFilterException.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'scbAdminPage' not found in wp-content/plugins/posts-to-posts/vendor/scribu/scb-framework/BoxesPage.php:5
    • > PHP Fatal error
      Uncaught Error: Interface 'Mustache_Loader' not found in wp-content/plugins/posts-to-posts/vendor/mustache/mustache/src/Mustache/Loader/CascadingLoader.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'P2P_Field_Title' not found in wp-content/plugins/posts-to-posts/admin/field-title-attachment.php:3
    • > PHP Fatal error
      Uncaught Error: Interface 'P2P_Field' not found in wp-content/plugins/posts-to-posts/admin/field-title.php:3
    • > PHP Fatal error
      Uncaught Error: Interface 'Mustache_Exception' not found in wp-content/plugins/posts-to-posts/vendor/mustache/mustache/src/Mustache/Exception/InvalidArgumentException.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'P2P_Side' not found in wp-content/plugins/posts-to-posts/vendor/scribu/lib-posts-to-posts/side-post.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'P2P_Item' not found in wp-content/plugins/posts-to-posts/vendor/scribu/lib-posts-to-posts/item-any.php:3

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
There were no browser issues found

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
5 plugin tags: users, many-to-many, relationships, custom post types, connections

posts-to-posts/posts-to-posts.php Passed 13 tests

The primary PHP file in "Posts 2 Posts" version 1.7.2 is used by WordPress to initiate all plugin functionality
61 characters long description:
Create many-to-many relationships between all types of posts.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Success! There were no dangerous files found in this plugin9,017 lines of code in 139 files:
LanguageFilesBlank linesComment linesLines of code
PHP1002,0863,8446,404
PO File185897251,398
JavaScript217389821
CSS2484191
HTML1170107
XML50071
Markdown116025

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.34
Average class complexity8.14
▷ Minimum class complexity1.00
▷ Maximum class complexity62.00
Average method complexity2.31
▷ Minimum method complexity1.00
▷ Maximum method complexity25.00
Code structure
Namespaces0
Interfaces9
Traits0
Classes96
▷ Abstract classes1515.62%
▷ Concrete classes8184.38%
▷ Final classes00.00%
Methods622
▷ Static methods10817.36%
▷ Public methods46073.95%
▷ Protected methods8713.99%
▷ Private methods7512.06%
Functions46
▷ Named functions46100.00%
▷ Anonymous functions00.00%
Constants68
▷ Global constants34.41%
▷ Class constants6595.59%
▷ Public constants65100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
3 compressed PNG files occupy 0.00MB
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/images/minus.png0.10KB0.11KB0.00%
admin/images/sort.png0.27KB0.16KB▼ 39.49%
admin/images/plus.png0.12KB0.12KB▼ 1.57%