{"id":21700195,"url":"https://github.com/wp-digital/wp-assets-version","last_synced_at":"2025-07-02T21:36:10.491Z","repository":{"id":56991699,"uuid":"325585693","full_name":"wp-digital/wp-assets-version","owner":"wp-digital","description":null,"archived":false,"fork":false,"pushed_at":"2022-10-05T13:20:17.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-04-05T01:32:54.024Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wp-digital.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-30T15:33:57.000Z","updated_at":"2023-07-23T15:07:48.000Z","dependencies_parsed_at":"2022-08-21T12:20:32.409Z","dependency_job_id":null,"html_url":"https://github.com/wp-digital/wp-assets-version","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-digital%2Fwp-assets-version","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-digital%2Fwp-assets-version/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-digital%2Fwp-assets-version/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-digital%2Fwp-assets-version/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wp-digital","download_url":"https://codeload.github.com/wp-digital/wp-assets-version/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248573477,"owners_count":21126839,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-25T20:13:28.070Z","updated_at":"2025-04-12T13:34:12.236Z","avatar_url":"https://github.com/wp-digital.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Assets Version\n\n### Description\n\nHelps with versioning of CSS and JS files. Plugin [adds](https://github.com/innocode-digital/wp-flush-cache#documentation)\nflush buttons to admin area for version upgrading.\n**Requires** [Flush Cache Buttons](https://github.com/innocode-digital/wp-flush-cache) plugin.\n\n### Install\n\n- Preferable way is to use [Composer](https://getcomposer.org/):\n\n    ````\n    composer require innocode-digital/wp-assets-version\n    ````\n\n  By default, it will be installed as [Must Use Plugin](https://codex.wordpress.org/Must_Use_Plugins).\n  It's possible to control with `extra.installer-paths` in `composer.json`.\n\n- Alternate way is to clone this repo to `wp-content/mu-plugins/` or `wp-content/plugins/`:\n\n    ````\n    cd wp-content/plugins/\n    git clone git@github.com:innocode-digital/wp-assets-version.git\n    cd wp-assets-version/\n    composer install\n    ````\n\nIf plugin was installed as regular plugin then activate **Assets Version** from Plugins page\nor [WP-CLI](https://make.wordpress.org/cli/handbook/): `wp plugin activate wp-assets-version`.\n\n### Usage\n\nThere are known functions [wp_enqueue_script](https://developer.wordpress.org/reference/functions/wp_enqueue_script/) and\n[wp_enqueue_style](https://developer.wordpress.org/reference/functions/wp_enqueue_style/) in WordPress core to register\nand enqueue scripts and styles. In both of them [4th parameter](https://developer.wordpress.org/reference/functions/wp_enqueue_script/#parameters)\nis for version number and in ideal case it should be version of build or theme or `null` with some version hash in filename ... \nbut sometimes it's hard to implement or there are could be particular issues in caching, and it's where this plugin becomes\nas a good **hotfix**. There are few ways to add version with this plugin:\n\n- Retrieve version through function `innocode_assets_version()` and set as 4th parameter in enqueue functions, e.g.:\n\n  ````\n  $ver = function_exists( 'innocode_assets_version' ) ? innocode_assets_version() : false;\n  \n  wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer );\n  ````\n  \n- Force using of version where `null` set as 4th parameter:\n\n  ````\n  add_filter( 'innocode_assets_version_allow_default', '__return_true' );\n  ````\n  \n- Force using of version but with own logic per dependency (requires previous hook to be set), e.g.:\n\n  ````\n  /**\n   * @param bool $allow\n   * @param string $type - One of [ 'script', 'style' ].\n   * @param _WP_Dependency $dependency\n   */\n  add_filter( 'innocode_assets_version_allow_dependency', function ( bool $allow, string $type, _WP_Dependency $dependency ) {\n      // @TODO: implement logic\n\n      return $allow;\n  }, 20, 3 );\n  ````\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwp-digital%2Fwp-assets-version","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwp-digital%2Fwp-assets-version","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwp-digital%2Fwp-assets-version/lists"}